|
@@ -11,13 +11,15 @@ module.exports = {
|
|
|
outputDir: 'dist',
|
|
outputDir: 'dist',
|
|
|
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
|
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
|
|
configureWebpack: config => {
|
|
configureWebpack: config => {
|
|
|
- config.plugins.push(
|
|
|
|
|
- new CompressionWebpackPlugin({
|
|
|
|
|
- test: /\.js$|\.html$|\.css$/,
|
|
|
|
|
- // 超过4kb压缩
|
|
|
|
|
- threshold: 4096
|
|
|
|
|
- })
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
+ config.plugins.push(
|
|
|
|
|
+ new CompressionWebpackPlugin({
|
|
|
|
|
+ test: /\.js$|\.html$|\.css$/,
|
|
|
|
|
+ // 超过4kb压缩
|
|
|
|
|
+ threshold: 4096
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
chainWebpack: (config) => {
|
|
chainWebpack: (config) => {
|
|
|
config.resolve.alias
|
|
config.resolve.alias
|