score:1

Please upgrade Webpack to version 2 or newer as it supports tree-shaking which eliminates unused exports.

As Webpack 2 supports native ES6 modules you must disable babel from transpiling ES6 modules to common-js format by configuring babel-loader presets (set modules: false in the es2015 preset):

{
  test: /\.js$/,
  exclude: /node_modules/,
  loader: 'babel-loader',
  options: {
    presets: [
      [
        'es2015', {
          modules: false
        }
      ]
      ...
    ]
  }
}

Tree-shaking should work with this configuration, inspect with the console or Webpack Bundle Analyzer Plugin.


Related Query

More Query from same tag