5

I am using this tutorial to try to load jquery into my SPF project. http://dev.office.com/sharepoint/docs/spfx/web-parts/basics/add-an-external-library

I followed strictly

tsd install jquery --save

Update the config.json in the config folder to load jQuery from CDN. Add an entry to the externals field:

"jquery": "https://code.jquery.com/jquery-3.1.0.min.js"

Import jQuery in your web part:

import * as $ from 'jquery';

However I keep getting this errors

Warning - tslint - src/webparts/helloWorld/HelloWorldWebPart.ts(12,13): error no-unused-variable: Unused import: '$'
Error - typescript - src/webparts/helloWorld/HelloWorldWebPart.ts(12,20): error TS2307: Cannot find module 'jquery'.
Error - 'typescript' sub task errored after 3.97 s 

1 Answer 1

1

Try using npm to install the typings:

npm install --save @types/jquery

Source: Add jQueryUI Accordion to your SharePoint client-side web part

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.