优化首屏
This commit is contained in:
@@ -72,7 +72,44 @@ export default defineConfig(({ envMode }) => {
|
||||
performance: {
|
||||
chunkSplit: {
|
||||
strategy: "split-by-module",
|
||||
override: {
|
||||
cacheGroups: {
|
||||
// 将大型编辑器库单独分包
|
||||
editor: {
|
||||
test: /[\\/]node_modules[\\/](codemirror|@codemirror|vue-codemirror|@wangeditor-next|md-editor-v3|y-codemirror\.next)[\\/]/,
|
||||
name: "vendor-editor",
|
||||
priority: 30,
|
||||
},
|
||||
// Chart.js 独立分包(包含 canvas-confetti)
|
||||
charts: {
|
||||
test: /[\\/]node_modules[\\/](chart\.js|vue-chartjs|@kurkle|canvas-confetti)[\\/]/,
|
||||
name: "vendor-charts",
|
||||
priority: 25,
|
||||
},
|
||||
// UI 框架(Naive UI 及其依赖)
|
||||
ui: {
|
||||
test: /[\\/]node_modules[\\/](naive-ui|@css-render|css-render|seemly|vooks|vueuc|treemate|vdirs|evtd)[\\/]/,
|
||||
name: "vendor-ui",
|
||||
priority: 20,
|
||||
},
|
||||
// Vue 生态
|
||||
vue: {
|
||||
test: /[\\/]node_modules[\\/](vue|vue-router|pinia|@vue|@vueuse)[\\/]/,
|
||||
name: "vendor-vue",
|
||||
priority: 15,
|
||||
},
|
||||
// 其他常用库
|
||||
common: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
name: "vendor-common",
|
||||
priority: 10,
|
||||
minChunks: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
// 移除 console.log(生产环境)
|
||||
removeConsole: ["log"],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user