Commit 729d8ca1 authored by 张伯涛's avatar 张伯涛

打包去掉 js 文件中所有注释

parent 7ec6f139
......@@ -56,6 +56,7 @@
"babel-eslint": "10.0.1",
"chalk": "2.4.2",
"connect": "3.6.6",
"crypto-js": "4.1.1",
"eslint": "5.15.3",
"eslint-plugin-vue": "5.2.2",
"html-webpack-plugin": "3.2.0",
......@@ -69,8 +70,8 @@
"stylus-loader": "^3.0.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.2",
"vue-template-compiler": "2.6.10",
"crypto-js": "4.1.1"
"terser-webpack-plugin": "^5.3.10",
"vue-template-compiler": "2.6.10"
},
"engines": {
"node": ">=8.9",
......
......@@ -57,7 +57,7 @@ module.exports = {
open: false,
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.1.14:8082/`,
target: `http://192.168.1.78:8082/`,
// target: `http://192.168.1.21:8001/`, // 张宇
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......@@ -74,6 +74,15 @@ module.exports = {
}
},
chainWebpack(config) {
// 删除注释
config.optimization.minimizer('terser').tap(args => {
// 直接修改 terserOptions 下的属性值,保留原有配置
// 这里访问 terserOptions 的时候并没有 output,访问不到 output.comments 需要直接赋值
args[0].terserOptions.output = {
comments: false,
}
return args
})
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment