使用new webpack.optimize.UglifyJsPlugin()时报错

Error: webpack.optimize.UglifyJsPlugin has been removed, please use config.optimization.minimize instead.

at Object.get [as UglifyJsPlugin] (/Users/yld/Documents/work/YLD/quality_trade/node_modules/webpack/lib/webpack.js:165:10)
    at Object.<anonymous> (/Users/yld/Documents/work/YLD/quality_trade/config/coinex.appprd.js:19:31)
    at Module._compile (/Users/yld/Documents/work/YLD/quality_trade/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)

杨天栾2018/07/12 16:00:11
1.webpack内置的JS压缩插件不能使用了,可以安装uglifyjs-webpack-plugin插件,使用同其他非内置插件; 2.--mode production 表示生产环境,只要配置在package.json的script里面 js自动就压缩了 Uglify是压缩js,现在已经不需要了,只需要在script里面写成 "build": "webpack --mode production", 就自动压缩了