Add uglifyjs plugin (#2070)
* Add uglifyjs plugin and replace -p flag with --env.production * Add uglifyjs plugin * Configure UglifyJsPlugin to drop console and prevent eslint error * Turn off no-console rule because uglifyjs plugin drops it in prod
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const { default: ImageminPlugin } = require('imagemin-webpack-plugin');
|
||||
const imageminMozjpeg = require('imagemin-mozjpeg');
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const config = require('./config');
|
||||
|
||||
@@ -21,5 +22,14 @@ module.exports = {
|
||||
plugins: [imageminMozjpeg({ quality: 75 })],
|
||||
disable: (config.enabled.watcher),
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
ecma: 8,
|
||||
compress: {
|
||||
warnings: true,
|
||||
drop_console: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user