Files
affiliate_dash/frontend/vite.config.ts
T
yml2213 e4d0a71963 支持 .env 配置,并完善源头对接文档与测试订单
- 增加 .env.example 与 godotenv 加载,start.sh 自动读环境变量
- 重写发给源头的开放接口对接文档
- 订单页支持创建测试订单(可直接已支付并复制店铺订单号)
2026-07-20 16:19:57 +08:00

27 lines
672 B
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, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig(({ mode }) => {
// 读取 frontend/.env* 与进程环境(start.sh 会注入根目录 .env
const env = loadEnv(mode, process.cwd(), '')
const apiTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:8080'
const port = Number(env.PORT || env.FRONTEND_PORT || 5173)
return {
plugins: [react()],
server: {
port,
proxy: {
'/api': {
target: apiTarget,
changeOrigin: true,
},
'/health': {
target: apiTarget,
changeOrigin: true,
},
},
},
}
})