Files
gamegroup2/frontend/vite.config.ts
T

42 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'node:path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
build: {
rollupOptions: {
output: {
// 代码分割:vendor 按依赖分组,避免单个超大 chunk
manualChunks: {
// Vue 核心运行时(vue + vue-router + pinia
'vue-vendor': ['vue', 'vue-router', 'pinia'],
// 桌面端 UI 库
'element-plus': ['element-plus', '@element-plus/icons-vue'],
// 手机端 UI 库
'vant': ['vant'],
// 后端 SDK
'pocketbase': ['pocketbase'],
// 语音房依赖(仅 VoiceRoom 用到,体积大,单独拆分)
'livekit': ['livekit-client'],
}
}
}
},
server: {
port: Number(process.env.VITE_PORT) || 5173,
proxy: {
'/api': {
target: process.env.VITE_PB_URL || 'http://localhost:8090',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})