This commit is contained in:
Your Name
2026-08-27 14:04:28 +08:00
parent f7720831be
commit 334890171e
3016 changed files with 263403 additions and 27971 deletions
+24
View File
@@ -0,0 +1,24 @@
import { defineConfig } from '@vben/vite-config';
export default defineConfig(async () => {
return {
application: {},
vite: {
server: {
proxy: {
// 前端统一请求 /api/*,代理到 admin_api.py 的 /api/v2/*。
// 走代理而不是直连,是为了开发态和生产态同源、没有 CORS 差异——
// 生产环境前端是静态文件,由同一个 Nginx 反代到后端。
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api/v2'),
// 端口可用环境变量覆盖:本机同时跑多套后端时(比如拿一次性的库
// 验证前端,不碰生产库)不用改代码。
target: process.env.VITE_API_TARGET || 'http://127.0.0.1:8766',
ws: false,
},
},
},
},
};
});