| 1 | import { defineConfig } from "vite"; |
| 2 | import react from "@vitejs/plugin-react"; |
| 3 | import tailwindcss from "@tailwindcss/vite"; |
| 4 | |
| 5 | export default defineConfig({ |
| 6 | plugins: [react(), tailwindcss()], |
| 7 | server: { |
| 8 | // 多会话并行开发:PORT 由启动器分配(5173 被占时换口),未设时保持默认 |
| 9 | port: process.env.PORT ? Number(process.env.PORT) : 5173, |
| 10 | proxy: { |
| 11 | // 后端端口可用 UTOPIA_DEV_API 覆盖(默认 1516,与 .env 的 UTOPIA_BIND_ADDR 一致) |
| 12 | "/api": process.env.UTOPIA_DEV_API ?? "http://127.0.0.1:1516", |
| 13 | }, |
| 14 | }, |
| 15 | }); |