babel-webpack-plugin
A babel plugin (not a loader) for webpack. If you're using webpack 2, transpile your ES2015 code to ES5 during optimization, not in the loader phase

The traditional way to load ES2015 modules into a `webpack`:webpack app is using `babel-loader`:babel-loader. With the release of webpack 2, this is no longer necessary – webpack now supports native JavaScript modules as well as Common JS, so code doesn’t need to be transformed before it’s passed to webpack. Doing so means `babel`:babel is run once for every input file, including anything imported from node_modules. And as loaders switch over to returning ES2015 modules, we’d need to start running `babel-loader` on every single file type, not just JavaScript.

Instead it’s preferable to pass webpack ES2015 code (which enables the new tree shaking feature) and then transform the entire bundle (or each chunk) into ES5 in one operation. That’s the purpose of babel-webpack-plugin:babel-webpack-plugin.

It works in almost exactly the same way as UglifyJsPlugin. Just add to the plugins list (before UglifyJs if you’re using it) and the code will be transformed from ES2015 to ES5 all in one go.

See the README on github for options

← OSVR Cardboard