I tried a new project and wanted to use webpack and modules to split the code. I installed npm and then installed webpack as follows
npm install -g webpack
npm install -g babel-cli babel-core babel-loader babel-presets-es2015
Now in my project, I created a new config.js file containing below content.
module.exports = {
entry: './src/js/app.js',
output: {
filename: 'dist/js/bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader'
}
]
},
}
However, I always get an error message
ERROR in Entry module not found: Error: Cannot resolve module 'babel-loader'
In other words, how to get webpack to allow globally installed packages?
source
share