优化首屏

This commit is contained in:
2025-10-05 21:07:29 +08:00
parent 7e6d03ca1a
commit 1ba042fae9
14 changed files with 233 additions and 114 deletions

View File

@@ -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: {