-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
51 lines (49 loc) · 1.31 KB
/
vite.config.js
File metadata and controls
51 lines (49 loc) · 1.31 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 { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
chunkSizeWarningLimit: 800, // 提高警告阈值到800kb
rollupOptions: {
output: {
manualChunks: (id) => {
// 根据模块ID动态确定分块
if (id.includes('node_modules')) {
if (id.includes('echarts')) {
return 'echarts';
}
if (id.includes('element-plus') || id.includes('@element-plus')) {
return 'element-plus-all'; // 将Element Plus和图标放在同一块中
}
if (id.includes('vue') || id.includes('pinia')) {
return 'vue-vendor';
}
// 其他第三方库归入vendor
return 'vendor';
}
}
}
}
},
server: {
port: 4100,
proxy: {
// 代理所有/api开头的请求到后端服务
'/api': {
target: 'http://localhost:8080', // 修改为您的实际后端地址
changeOrigin: true,
}
}
},
})