question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The ProvidePlugin for jquery was invalid in the scaffolding project

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

22reactions
narwajeacommented, Nov 10, 2016

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:

module.exports = {
  root: true,
  env: {
    browser: true,
    jquery: true
  },
...
}
2reactions
borekwacommented, May 3, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found