[英]Webpack UglifyJsPlugin Error when nonuse sourceMap
I know UglifyJsPlugin do not support ES6 , so there has some problems when ES6 transform to ES5 我知道UglifyJsPlugin不支持ES6 ,所以当ES6转换为ES5时存在一些问题
In production env Error: Unexpected token punc «,», expected punc «:» [bundle.js:2808,8] 在生产环境中错误: 意外的标记点«,»,预期的标记«:»[bundle.js:2808,8]
new webpack.optimize.UglifyJsPlugin({
output: {
comments: false
}
})
But It's OK In development env 但是在开发环境中还可以
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
output: {
comments: false
}
})
Webpack v2.4.1 and babel v6.5.2 Webpack presets: ["es2015","stage-0","react"] Webpack v2.4.1和babel v6.5.2 Webpack预设:[“ es2015”,“ stage-0”,“ react”]
The screenshot of error : enter image description here 错误的屏幕截图: 在此处输入图片描述
Finally, I find the code what I post is not ES6, while it follow the CMD principle. 最后,我发现我发布的代码不是ES6,而是遵循CMD原理。 That code Webpack will not transform and UglifyJsPlugin can't transform.
该代码Webpack不会转换,而UglifyJsPlugin不能转换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.