重构代码,优化组件加载和样式,移除不必要的依赖,增强首屏渲染性能

This commit is contained in:
Sunwuyuan
2026-03-03 21:16:32 +08:00
parent 97c70f6706
commit cf3412db6a
16 changed files with 424 additions and 302 deletions
+25 -5
View File
@@ -158,11 +158,11 @@ export default defineConfig({
},
}),
Components({
//resolvers: [
// TDesignResolver({
// library: 'vue-next'
// })
//]
// 排除已在 index.vue 中通过 defineAsyncComponent 手动懒加载的组件
// 避免 unplugin-vue-components 生成冲突的静态 import
directoryAsNamespace: false,
globs: ['src/components/**/[A-Z]*.vue'],
exclude: [/pages\/index\.vue$/],
}),
Fonts({
google: {
@@ -198,6 +198,26 @@ export default defineConfig({
'.vue',
],
},
build: {
// ===== Chunk 分割优化 =====
chunkSizeWarningLimit: 500,
rollupOptions: {
output: {
manualChunks: {
// 核心框架(极少变动,长缓存)
'vendor-vue': ['vue', 'vue-router', 'pinia'],
// UI 框架
'vendor-vuetify': ['vuetify'],
// 监控(异步加载,独立 chunk)
'vendor-sentry': ['@sentry/vue'],
// 实时通信
'vendor-socket': ['socket.io-client'],
// 通用工具库
'vendor-utils': ['axios', 'uuid', 'js-base64'],
},
},
},
},
server: {
port: 3031,
},