siftlode/frontend/vite.config.ts
npeter83 3f4d5ed9d7 fix(dev): vite proxy to 127.0.0.1 + throttle error notifications
The dev proxy targeted 'localhost', which Node can resolve to IPv6 ::1 that the
Docker publish doesn't answer after a container recreate — every /api call failed,
spamming 'Network error'. Pin the proxy to 127.0.0.1. Also collapse bursts of
connection/5xx failures into one notification per 30s so a brief restart no longer
floods the notification center.
2026-06-11 22:00:57 +02:00

18 lines
566 B
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// During `vite dev` (host with Node), proxy API calls to the backend container.
// Use 127.0.0.1 (not "localhost") so Node doesn't resolve to IPv6 ::1, which the
// Docker port publish may not answer — that surfaces as proxy connection failures.
const target = "http://127.0.0.1:8080";
const proxy = {
"/api": target,
"/auth": target,
"/healthz": target,
};
export default defineConfig({
plugins: [react()],
server: { port: 5173, proxy },
build: { outDir: "dist" },
});