Files
novalon-manage-system/novalon-manage-web/vite.config.ts
T
张翔 8ddd99f54f fix(e2e): 添加网关服务启动,修复架构问题
问题:
- 前端直接访问后端(8084),未通过网关
- 网关服务(8080)未启动
- 导致认证和授权流程失败

修复:
1. 前端配置:
   - 修改 vite.config.ts,代理目标改为网关(8080)
   - 支持环境变量 VITE_API_TARGET

2. 测试环境:
   - 添加网关服务启动逻辑
   - 添加 waitForGatewayReady 健康检查
   - 添加网关服务停止逻辑
   - 修改 cleanupTestData API 地址(8084 -> 8080)

架构:
- 前端(3002)-> 网关(8080)-> 后端(8084)
- 网关负责:JWT认证、RBAC授权、限流、熔断
2026-04-07 09:57:06 +08:00

62 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
server: {
port: 3002,
host: '0.0.0.0',
strictPort: true,
proxy: {
'/api': {
target: process.env.VITE_API_TARGET || 'http://localhost:8080',
changeOrigin: true,
secure: false
}
},
hmr: {
overlay: false
},
cors: true
},
build: {
target: 'esnext',
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
},
rollupOptions: {
output: {
manualChunks: {
'vue-vendor': ['vue', 'vue-router', 'pinia'],
'element-plus': ['element-plus'],
'utils': ['lodash-es', 'axios']
}
}
},
chunkSizeWarningLimit: 1000,
reportCompressedSize: false
},
optimizeDeps: {
include: ['vue', 'vue-router', 'pinia', 'element-plus', 'axios', 'lodash-es'],
exclude: []
},
css: {
devSourcemap: false,
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/variables.scss";`
}
}
}
})