import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react-swc'; // In dev, the UI is served by Vite at :5173 and proxies `/api/*` to the // moments-api binary at :8080 (default). In prod, nginx serves the static // build and reverse-proxies the same `/api/*` to the API backend, so the // frontend's URL shape is identical in both environments. export default defineConfig({ plugins: [react()], server: { proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), }, }, }, });