import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' // Im Dev-Modus laufen Frontend (5173) und Backend (3001) getrennt. // Damit das Frontend trotzdem relative URLs ("/api/...") verwenden kann, // proxyt Vite alle /api-Anfragen an das Backend. Das Ziel ist konfigurierbar: // - lokal ohne Docker: http://localhost:3001 (Standard) // - Docker-Dev: VITE_PROXY_TARGET=http://backend:3001 const proxyTarget = process.env.VITE_PROXY_TARGET || 'http://localhost:3001' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], server: { host: '0.0.0.0', port: 5173, watch: { usePolling: true }, proxy: { '/api': { target: proxyTarget, changeOrigin: true } } } })