我曾经在使用UglifyJS处理Webpack和ES6模块时遇到问题:
来自UglifyJs的static/js/vendor.6ccd9e38979a78765c7a.js中的错误 意外的标记: name (features) [./node_modules/pica/lib/mathlib.js:19,0][static/js/vendor.6ccd9e38979a78765c7a.js:39003,6]
我了解到Webpack插件的新测试版本支持ES6:
https://github.com/webpack-contrib/uglifyjs-webpack-plugin
new webpack.optimize.UglifyJsPlugin({
uglifyOptions: {
ie8: false,
ecma: 8, // I also tried 7 and 6
parse: {},
mangle: {
properties: {
// mangle property options
}
},
output: {
comments: false,
beautify: false
},
compress: {},
warnings: true
}
}),
然而,现在我又遇到了另一个错误:
来自UglifyJs的static/js/vendor.6ccd9e38979a78765c7a.js中的ERROR 意外的令牌:名称(features) [static/js/vendor.6ccd9e38979a78765c7a.js:39003,6]
可能是什么问题呢?