去掉console.log,以及开启gzip
const CompressionPlugin = require('compression-webpack-plugin');//引入gzip压缩插件
configureWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
//npm install terser-webpack-plugin -D, 去掉console
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
return {
plugins: [
new CompressionPlugin({
test: /\.js$|\.html$|\.css/,
threshold: 10240,
deleteOriginalAssets: false
})
]
}
}
},