This error is happening because the current uglify-js dependency that is in webpack.optimize.UglifyJsPlugin() does not yet support ES6 JavaScript syntax.
Because of this, you have a few options:
transpile your JavaScript to a syntax that uglify will support: This can be done by using babel-preset-env and setting the property uglify: true in your .babelrc file.
Use an es6 aware minifier such as butternut (which I believe has a webpack plugin), closure compiler, or babili (which can be used via a babel plugin added to your .babelrc file.
This error is happening because the current uglify-js dependency that is in
webpack.optimize.UglifyJsPlugin()
does not yet support ES6 JavaScript syntax.Because of this, you have a few options:
transpile your JavaScript to a syntax that uglify will support: This can be done by using
babel-preset-env
and setting the propertyuglify: true
in your.babelrc
file.Use an es6 aware minifier such as
butternut
(which I believe has a webpack plugin),closure compiler
, orbabili
(which can be used via a babel plugin added to your.babelrc
file.