前端加载优化:代码分割 + 按需懒加载

chat.js 首屏 308KB → 100KB(↓68%)
44 个重型模块改为 Vite 动态 import()
Alpine 组件通过 $watch 监听实现真懒加载
新增 createLazyAlpineComponent 工具 + Proxy has 陷阱修复
补充 userCardComponent 全部 28 个属性默认值
vendor 依赖独立分包(108KB)
生产环境关闭 sourcemap
This commit is contained in:
pllx
2026-04-28 09:38:18 +08:00
parent e8b4dcc968
commit e50502d8f6
5 changed files with 1507 additions and 729 deletions
+12
View File
@@ -19,6 +19,18 @@ export default defineConfig({
}),
tailwindcss(),
],
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
return "vendor";
}
},
},
},
sourcemap: false,
},
server: {
watch: {
ignored: ["**/storage/framework/views/**"],