mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-20 10:59:21 +08:00
perf: 优化构建速度 (#112)
This commit is contained in:
parent
2cd7b161e8
commit
88033a823d
@ -47,23 +47,29 @@ export default (configEnv: ConfigEnv): UserConfigExport => {
|
||||
},
|
||||
build: {
|
||||
/** 消除打包大小超过 500kb 警告 */
|
||||
chunkSizeWarningLimit: 2000,
|
||||
/** Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效 */
|
||||
minify: "terser",
|
||||
/** 在打包代码时移除 console.log、debugger 和 注释 */
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: false,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ["console.log"]
|
||||
},
|
||||
format: {
|
||||
/** 删除注释 */
|
||||
comments: false
|
||||
}
|
||||
},
|
||||
chunkSizeWarningLimit: 2048,
|
||||
/** 禁用 gzip 压缩大小报告 */
|
||||
reportCompressedSize: false,
|
||||
/** 打包后静态资源目录 */
|
||||
assetsDir: "static"
|
||||
assetsDir: "static",
|
||||
/** 分块策略 */
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
vue: ["vue", "vue-router", "pinia"],
|
||||
elment: ["element-plus", "@element-plus/icons-vue"],
|
||||
vxe: ["vxe-table", "vxe-table-plugin-element", "xe-utils"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
esbuild: {
|
||||
/** 在打包代码时移除 console.log */
|
||||
pure: ["console.log"],
|
||||
/** 在打包代码时移除 debugger */
|
||||
drop: ["debugger"],
|
||||
/** 在打包代码时移除所有注释 */
|
||||
legalComments: "none"
|
||||
},
|
||||
/** Vite 插件 */
|
||||
plugins: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user