Search code examples
javascriptwebpackbabeljsecmascript-5transpiler

Webpack babel transpile to es5 doesn't quite work


I'm trying to build my ES7 source code into a single file and have it transpiled down to ES5 but when I run webpack I still notice code like this in the built bundle

t.exports=class extends n(0).Component{title(){return this.constructor.name}}}

The export of the class means that something is not quite working, this is my relevant webpack config

module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["env"]
          }
        }
      },

What am I doing wrong?


Solution

  • In order to save someone else the precious few hours I wasted - I was including libraries that contained ES5+ code from node_modules and as obvious as it is the config is ignoring node_modues, so I just had to remove that line.