Forum Discussion

RomanRomych's avatar
RomanRomych
Copper Contributor
Jan 05, 2021

jQuery is not defined in SPFx extension

I have created SPFx extension (not a webpart, in case it makes any difference) and trying to add jQuery but its not doing it. I have installed it into package with

npm install --save @types/jquery

added

"externals": {
"jquery": "./src/extensions/tracker2/js/JQuery_3.5.1.js"
},


into config.json ,

import * as jQuery from 'jquery';

into MyPackage.ts
But still getting " jQuery is not defined " when trying to use jQuery in my code.

Thanks

  • pwmusic's avatar
    pwmusic
    Copper Contributor

    Hi RomanRomych.

    Did you ever work out what was going wrong with this?

     

    I have exactly the same issue and have burned hours trying to find a solution, all without any success.

Resources