'jquery is not defined' when using webpack to load bootstrap 'jquery is not defined' when using webpack to load bootstrap jquery jquery

'jquery is not defined' when using webpack to load bootstrap


Add this as plugin

  new webpack.ProvidePlugin({   $: "jquery",   jQuery: "jquery"  })

and you should be able to have jquery in your whole project.

If issue persists after adding the plugin, try restarting your nodejs server. Remember to install jquery using npm install --save jquery.


Plugin is not needed. Just use following as entry:

entry: [    'jquery', //will load jquery from node_modules    './assets/js/index',]

Then in ES6+ file use:

import $ from "jquery";


I know this is a bit old, but I managed to do it like that :

global.jQuery = require('jquery');require('bootstrap');