0

Having a problem with babel-loader or maybe my webpack config. If I use my current implementation works fine, but I know that the test pattern is wrong(i think). Currently a glob, not a regex. If I change it according to doc's, get the following error. I have blown away node_modules and npm installed.

Error: Can't resolve 'bable-loader' in /path/to/app

//no error
rules: [{
      test: /\*.js$/,
      use: ['ng-annotate-loader', 'bable-loader'],
      exclude: /node_modules/
    },


//throws error
rules: [{
    test: /\.js$/,
    use: ['ng-annotate-loader', 'bable-loader'],
    exclude: /node_modules/
  },


//file : .babelrc 

{
  "env": {
    "testing": {
      "presets": [
        "es2015"
      ]
    }
  },
  "presets": [
    ["es2015", "stage-2", {
      "modules": false
    }]
  ]
}
alphapilgrim
  • 3,761
  • 8
  • 29
  • 58

2 Answers2

7

It seems you are misspelling babel-loader.. It also looks like you need a good night of sleep.

enapupe
  • 15,691
  • 3
  • 29
  • 45
1

From the documentation of the babel-loader plugin:

https://webpack.js.org/loaders/babel-loader/#usage

 module: {
  rules: [
    {
      test: /\.js$/,
      exclude: /(node_modules|bower_components)/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['env']
        }
      }
    }
  ]
}

You should be typing babel-loader. Not bable-loader. Bable is a typo, thus it cant find it.

Juan
  • 6,125
  • 3
  • 30
  • 31