This commit is contained in:
truewhile
2026-09-04 11:56:29 +08:00
parent cc40169616
commit 203abd106a
72 changed files with 1979 additions and 1155 deletions
+20
View File
@@ -24,5 +24,25 @@ export default defineConfig({
build: {
outDir: 'dist',
sourcemap: false,
rollupOptions: {
output: {
// 只拆哈希长期稳定的核心库:业务代码发版后用户只需重新下载变小的
// 业务 chunk,核心 vendor 走浏览器长缓存。其余依赖保持 Vite 默认
// 分块,避免把 hls.js 等懒加载库拖进首屏。
manualChunks(id) {
if (!id.includes('node_modules')) return undefined
if (/[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom|scheduler)[\\/]/.test(id)) {
return 'vendor-react'
}
if (/[\\/]node_modules[\\/](axios|zustand)[\\/]/.test(id)) {
return 'vendor-data'
}
if (/[\\/]node_modules[\\/]framer-motion[\\/]/.test(id)) {
return 'vendor-motion'
}
return undefined
},
},
},
},
})