26 lines
768 B
TypeScript
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 },
|
|
},
|
|
},
|
|
});
|