|
|
@ -96,8 +96,26 @@ module.exports = { |
|
|
|
'@': resolve('src') |
|
|
|
'@': resolve('src') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
plugins:[compress], |
|
|
|
}, |
|
|
|
}, |
|
|
|
chainWebpack: config => { |
|
|
|
chainWebpack: config => { |
|
|
|
|
|
|
|
if(IS_PROD){ |
|
|
|
|
|
|
|
config.optimization.minimizer=[ |
|
|
|
|
|
|
|
new UglifyJsPlugin({ |
|
|
|
|
|
|
|
uglifyOptions: { |
|
|
|
|
|
|
|
output: { |
|
|
|
|
|
|
|
comments: false, // 去掉注释
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
warnings: false, |
|
|
|
|
|
|
|
compress: { |
|
|
|
|
|
|
|
drop_console: true, |
|
|
|
|
|
|
|
drop_debugger: true, |
|
|
|
|
|
|
|
pure_funcs: ['console.log']//移除console
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (page==='analyz') { |
|
|
|
if (page==='analyz') { |
|
|
|
config |
|
|
|
config |
|
|
@ -119,21 +137,9 @@ module.exports = { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if(IS_PROD){ |
|
|
|
// 移除prefetch插件,避免加载多余的资源
|
|
|
|
config.plugins=[compress,new UglifyJsPlugin({ |
|
|
|
config.plugins.delete('prefetch'); |
|
|
|
uglifyOptions: { |
|
|
|
|
|
|
|
output: { |
|
|
|
|
|
|
|
comments: false, // 去掉注释
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
warnings: false, |
|
|
|
|
|
|
|
compress: { |
|
|
|
|
|
|
|
drop_console: true, |
|
|
|
|
|
|
|
drop_debugger: true, |
|
|
|
|
|
|
|
pure_funcs: ['console.log']//移除console
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// config.plugins.delete('preload');
|
|
|
|
// config.plugins.delete('preload');
|
|
|
|
|
|
|
|
|
|
|
|