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

28 lines
927 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: {
// ws:true is required for the terminal WebSocket to be proxied to the
// Go backend in dev. http-only proxies strip the Upgrade header.
"/api": { target: backendTarget, changeOrigin: true, ws: true },
"/healthz": { target: backendTarget, changeOrigin: true },
},
},
});