import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import path from 'path' import { fileURLToPath } from 'url' const __dirname = path.dirname(fileURLToPath(import.meta.url)) // One SPA at `/`. The auth screens keep /auth/* as *router* paths so the // backend's CONFIRM_EMAIL_PATH=/auth/confirm-email links resolve unchanged. // // `vite dev` and `vite preview` both serve index.html for unmatched paths, which // is what devserver.py's SPA_ROOTS hack used to fake — and they do it for every // path, not just /auth/. A CDN/S3 deploy needs an equivalent rewrite rule. export default defineConfig({ plugins: [react()], base: '/', build: { outDir: 'dist', emptyOutDir: true, sourcemap: true }, resolve: { alias: { '@': path.resolve(__dirname, 'src') } }, server: { port: 5173, // Same-origin style for local Vite when VITE_API_BASE is empty. // Requires API published on the host (docker-compose.host-ports.yml). proxy: { '^/(health|users|roles|permissions|permission-tags|email|job|jobs|candidate|notes|interview|feedback|activity|pipeline|notifications|analytics|offers|tasks|assessments|org-settings|saved-searches|search|documents|sheet|managers|inbox)(/|$)': { target: 'http://127.0.0.1:8000', changeOrigin: true, }, }, }, preview: { port: 4173 }, })