1 个回答

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.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题