feat: 构建体积优化

Former-commit-id: 21a1d9e8a9
This commit is contained in:
april 2023-08-31 17:13:15 +08:00
parent 960306a160
commit b1dbeecd49
2 changed files with 16 additions and 1 deletions

View File

@ -57,6 +57,7 @@
"pinia": "^2.0.33",
"screenfull": "^6.0.0",
"sortablejs": "^1.15.0",
"terser": "^5.19.3",
"vue": "^3.3.4",
"vue-i18n": "9.2.2",
"vue-router": "^4.2.0",

View File

@ -187,7 +187,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
"element-plus/es/components/notification/style/css",
"@vueuse/core",
"sortablejs",
"path-to-regexp",
"echarts",
"@wangeditor/editor",
@ -196,5 +195,20 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
"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, // 删除注释
},
},
},
};
});