The ProvidePlugin for jquery was invalid in the scaffolding project
See original GitHub issueI want to make the scaffolding project to support jquery, then I input the below code in the file webpack.dev.conf.js as the description from http://webpack.github.io/docs/shimming-modules.html,
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery" }),
In the console log, I had found there was a new ProvidePlugin indeed, but in the vue or js , it always threw the below error " ‘$’ is not defined"
that is to say,I was unable to make $ and jQuery available in every module without writing require(“jquery”).
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
jquery - $ is not defined in Laravel 5.6 projects with make:auth ...
The ProvidePlugin that's shipped with webpack will expose factory variables globally to be used anywhere in your application.
Read more >ProvidePlugin - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >How to use Webpack in ASP.Net core projects; a basic React ...
Let us now use a plugin, named “ProvidePlugin”. This plugin automatically loads modules instead of having to import or require them everywhere.
Read more >Igniteui-angular2 use with Webpack? | Infragistics Forums
Hello Team,. I am trying to use igniteui-angular2 components with my angular2 App. It works fine with simpler application.
Read more >vuejs/vue - Gitter
Hey guys I am trying to Load Jquery TouchSPin in Vue2. ... npm as other libraries. vue-cli is just for scaffolding vue-based projects....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem comes from eslint not allowing jQuery to be referenced globally. Adding jquery to the env attribute of your .eslintrc.js should do the trick. Here’s mine:
eslint does seem to be the issue, but adding it to env did not fix it for me. Instead, I had to add it to the ‘globals’ of .eslintrc.js and that fixed it for me.
See http://stackoverflow.com/questions/37077136/webpack-not-including-provideplugins