feat: 构建体积优化
Former-commit-id: 21a1d9e8a99c8b45db72cffc90346c61456df71d
This commit is contained in:
@@ -57,6 +57,7 @@
|
|||||||
"pinia": "^2.0.33",
|
"pinia": "^2.0.33",
|
||||||
"screenfull": "^6.0.0",
|
"screenfull": "^6.0.0",
|
||||||
"sortablejs": "^1.15.0",
|
"sortablejs": "^1.15.0",
|
||||||
|
"terser": "^5.19.3",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-i18n": "9.2.2",
|
"vue-i18n": "9.2.2",
|
||||||
"vue-router": "^4.2.0",
|
"vue-router": "^4.2.0",
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||||||
"element-plus/es/components/notification/style/css",
|
"element-plus/es/components/notification/style/css",
|
||||||
"@vueuse/core",
|
"@vueuse/core",
|
||||||
"sortablejs",
|
"sortablejs",
|
||||||
|
|
||||||
"path-to-regexp",
|
"path-to-regexp",
|
||||||
"echarts",
|
"echarts",
|
||||||
"@wangeditor/editor",
|
"@wangeditor/editor",
|
||||||
@@ -196,5 +195,20 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||||||
"codemirror",
|
"codemirror",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
// 构建
|
||||||
|
build: {
|
||||||
|
chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告
|
||||||
|
minify: "terser", // Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效
|
||||||
|
terserOptions: {
|
||||||
|
compress: {
|
||||||
|
keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题
|
||||||
|
drop_console: true, // 生产环境去除 console
|
||||||
|
drop_debugger: true, // 生产环境去除 debugger
|
||||||
|
},
|
||||||
|
format: {
|
||||||
|
comments: false, // 删除注释
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user