I'm trying to add jQuery in the bundle, so far webpack 3 is not making it easy, i've seen the question asked several times, and none of the answers worked.
I added all the parts that are supposed to make this work
In webpack.config.js
externals: {
jquery: 'jQuery'
},
plugins: [
new webpack.DefinePlugin({
'$': 'jquery',
'jQuery': 'jquery',
'window.jQuery': 'jquery'
})
]
In entry file: app.jsx
window.$ = window.jQuery = require("jquery");
Webpack compiles, but in the browser I get the same error
Here's the repo, incase anyone wanna take a look at the files
Thanks alot in advance :)
You need to use ProvidePlugin, not DefinePlugin. And also remove "externals" section.