import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-oxc"; import tailwindcss from "@tailwindcss/vite"; import path from "path"; // Browser requests arrive at Vite, which then proxies them to the backend. // Locally the backend is published on the host; Docker Compose supplies the // service hostname instead (see docker-compose.yml). const backendUrl = process.env.BACKEND_URL ?? "http://localhost:8001"; export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { "@": path.resolve(__dirname, "./src"), }, }, server: { proxy: { // CopilotKit runtime (Hono server, dev only) "/api/copilotkit": { target: "http://localhost:3001", changeOrigin: true, }, // All other API calls → Python backend "/api": { target: backendUrl, changeOrigin: true, }, }, }, });