import { fileURLToPath, URL } from 'node:url'; import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; // Le backend tourne sur :8000 en dev (voir docker-compose.yml). export default defineConfig({ plugins: [react()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { host: true, port: 5173, proxy: { // Le back-end expose ses routes sous `/editions/...` (pas `/api`) : // on retire le préfixe avant de forwarder. '/api': { target: process.env.VITE_API_TARGET ?? 'http://localhost:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), }, }, }, });