This repository has been archived on 2026-07-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
codespace/web/vite.config.ts
T
2026-07-03 11:05:56 +08:00

26 lines
768 B
TypeScript

import path from "node:path";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
// In dev the frontend runs on its own port; proxy API calls to the Go backend
// so the browser sees same-origin requests. In production the Go binary serves
// the built assets directly and no proxy is involved.
const backendTarget =
process.env.VITE_BACKEND_URL ?? "http://localhost:8080";
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
proxy: {
"/api": { target: backendTarget, changeOrigin: true },
"/healthz": { target: backendTarget, changeOrigin: true },
},
},
});