47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
/**
|
|
* 前端开发服务器配置;本地 /api 代理到真实 DevOps API,避免引入 mock 数据。
|
|
*/
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
build: {
|
|
rolldownOptions: {
|
|
output: {
|
|
codeSplitting: {
|
|
groups: [
|
|
{
|
|
name: 'element-plus-vendor',
|
|
test: /node_modules[\\/](?:\.pnpm[\\/].*?[\\/]node_modules[\\/])?(?:element-plus|@element-plus|@vueuse)[\\/]/,
|
|
priority: 30,
|
|
},
|
|
{
|
|
name: 'vue-vendor',
|
|
test: /node_modules[\\/](?:\.pnpm[\\/].*?[\\/]node_modules[\\/])?(?:vue|@vue|vue-router|pinia)[\\/]/,
|
|
priority: 20,
|
|
},
|
|
{
|
|
name: 'vendor',
|
|
test: /node_modules[\\/]/,
|
|
priority: 10,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
port: 4301,
|
|
proxy: {
|
|
'/api': {
|
|
target: process.env.DEVOPS_API_PROXY_TARGET ?? 'http://localhost:4300',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
},
|
|
},
|
|
})
|