Skip to content

$ is not defined (with webpack) #272

Description

@maejml

Got this error when I import sticky-kit with webpack :

Uncaught TypeError: $ is not a function at Object.<anonymous> (sticky-kit.js:9) at Object../node_modules/sticky-kit/dist/sticky-kit.js (sticky-kit.js:326) at __webpack_require__ (bootstrap:19) ...

My import line import 'sticky-kit/dist/sticky-kit'; is working.
jQuery is working too (debugged with a console log), I have the right lines in environment.js and config etc.

In the config, I added this rule as seen in another question but it didn't work :
{ test: /\.js$/, include: [ path.join(__dirname, 'node_modules', 'sticky-kit') ], use: [{ loader: 'imports-loader?jQuery=jquery,$=jquery,window=>global&window.jQuery=jquery,this=>window,define=>false' }] }

What am I not doing right ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions