import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import { resolve } from "path"; import { readFileSync } from "node:fs"; const pkg = JSON.parse( readFileSync(resolve(__dirname, "package.json"), "utf-8"), ) as { version: string }; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], define: { /** BanGUI application version injected at build time from package.json. */ __APP_VERSION__: JSON.stringify(pkg.version), }, resolve: { alias: { "@": resolve(__dirname, "src"), }, }, server: { port: 5173, proxy: { "/api": { // In the dev compose stack the backend is reachable via its service // name on the shared Docker/Podman network. Using "localhost" would // resolve to the frontend container itself and cause ECONNREFUSED. target: "http://backend:8000", changeOrigin: true, }, }, }, });