0

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.

msrumon
  • 1,250
  • 1
  • 10
  • 27

2 Answers2

0

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

Grzegorz T.
  • 3,903
  • 2
  • 11
  • 24
0

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
user8128167
  • 6,929
  • 6
  • 66
  • 79