-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
51 lines (46 loc) · 1.17 KB
/
vite.config.js
File metadata and controls
51 lines (46 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
server: {
port: 5173,
open: true
},
build: {
chunkSizeWarningLimit: 800,
rollupOptions: {
output: {
// 手动分包配置
manualChunks(id) {
if (id.includes('node_modules')) {
// 3D 库体积较大
if (id.includes('three') || id.includes('ogl')) {
return 'three-vendor';
}
// Excel 处理库
if (id.includes('xlsx')) {
return 'xlsx-vendor';
}
// 图表库
if (id.includes('recharts')) {
return 'charts-vendor';
}
// 动画库
if (id.includes('framer-motion') || id.includes('gsap')) {
return 'motion-vendor';
}
// 其他所有第三方依赖打包到 vendor 中,避免依赖顺序问题
return 'vendor';
}
},
},
},
},
})