问题
This image contains folder structure and webpack.config.js file. When I open webpack-dev-server, I get the following error:
ERROR in multi (webpack)-dev-server/client?http://localhost:8080 ./src/js/index.js ./src/scss/master.scss
Module not found: Error: Can't resolve 'babel/loader' in 'C:\wamp64\www\o\omd'
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/js/index.js ./src/scss/master.scss main[0]
Note than I have installed babel/loader
inside node_modules
. Any clue would be appreciated!
Thanks in advance.
回答1:
This is the correct formula, after all, below scss
you are well declared
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
I suggest adding the presets in a separate file. Create .babelrc
file and add to it.
{
"presets": [
[
"@babel/preset-env"
]
]
}
Look here - example
回答2:
Please note that I also had the same problem so to resolve it I installed babel-loader
according to their website (see https://github.com/babel/babel-loader):
npm install -D babel-loader @babel/core @babel/preset-env webpack
来源:https://stackoverflow.com/questions/58230055/error-in-multi-module-not-found-error-cant-resolve-babel-loader