优化写法
Former-commit-id: 30723ec95813747dbd55054b42d7b480489b2ab0 [formerly 30723ec95813747dbd55054b42d7b480489b2ab0 [formerly 30723ec95813747dbd55054b42d7b480489b2ab0 [formerly 30723ec95813747dbd55054b42d7b480489b2ab0 [formerly 00103fb3d8da9c47bb9a7ede036a0aacd75efcd8 [formerly 033b78abeacaf34e7b49bf7737757fd31b4e0389]]]]] Former-commit-id: 6cce6f23a44636b918dc98ca3398c01165158143 Former-commit-id: b53123a9ce1e9a27b6108955eef6d52d4cce11ad Former-commit-id: 353dbb0ad9d402ad10c082a442e32b9edd89b076 [formerly da553cc21680df7ac5a9baf7416fe9dbf840ad32] Former-commit-id: 6b5a9da647f6d5467682bc42c568a52422bbe61d Former-commit-id: 9e64087cfd10811375f0afb5e50a27ba4ddf7aee Former-commit-id: e791cca914171ee88101e28585068a7e600ef199 Former-commit-id: 31a432c983a493278037032ad2963b4fd67e3b70 Former-commit-id: b9242379f9958374fe9eecee97d6bb56e1ab6a67
This commit is contained in:
parent
45242ef5af
commit
28d9817885
|
|
@ -34,23 +34,30 @@ module.exports = {
|
|||
// 解决 cli3 热更新失效 https://github.com/vuejs/vue-cli/issues/1559
|
||||
config.resolve
|
||||
.symlinks(true)
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
config.optimization
|
||||
// 生产环境移除 console
|
||||
// 其它优化选项 https://segmentfault.com/a/1190000008995453?utm_source=tag-newest#articleHeader12
|
||||
.minimizer([
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
warnings: false,
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ['console.log']
|
||||
config
|
||||
// 开发环境
|
||||
.when(process.env.NODE_ENV === 'development',
|
||||
// sourcemap不包含列信息
|
||||
config => config.devtool('cheap-source-map')
|
||||
)
|
||||
// 非开发环境
|
||||
.when(process.env.NODE_ENV !== 'development', config => {
|
||||
config.optimization
|
||||
.minimizer([
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
// 移除 console
|
||||
// 其它优化选项 https://segmentfault.com/a/1190000010874406
|
||||
compress: {
|
||||
warnings: false,
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ['console.log']
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
])
|
||||
}
|
||||
})
|
||||
])
|
||||
})
|
||||
// markdown
|
||||
config.module
|
||||
.rule('md')
|
||||
|
|
|
|||
Loading…
Reference in New Issue