When I run webpack, _
returns as undefined on window: window._ ::: Error: _ is not defined
. I thought that putting _
inside the plugins will expose it to window
. Is my understanding incorrect?
const webpack = require('webpack');
const plugins = new webpack.ProvidePlugin({
$: "jquery",
_: "underscore"
});
module.exports = {
entry: {
app: './src/main/app/components/main.module.js',
vendor: [
'jquery',
'underscore'
]
},
output: {
filename: './src/main/resources/dist/app/scripts/[name].bundle.js',
},
plugins: [plugins],
devtool: 'inline-source-map'
};