webpack 下UglifyJs打包压缩报错 Unexpected token: punc (()
网上普遍解决方法是说es6配置问题,实际没有解决我的问题,修改UglifyJs配置解决,方案如下
旧代码
new webpack.optimize.UglifyJsPlugin({
mangle: {
except: ['$super', '$', 'exports', 'require', 'module', '_']
},
compress: {
warnings: false
},
output: {
comments: false,
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
新代码
new UglifyJsPlugin({
"uglifyOptions":
{
mangle: {
reserved: ['$super', '$', 'exports', 'require', 'module', '_']
},
compress: {
warnings: false
},
output: {
comments: false,
},
sourceMap: config.build.productionSourceMap,
parallel: true
}
}
),
最新评论