Angepass an Produtionumgebung

This commit is contained in:
2026-06-21 17:29:39 +02:00
parent 99678ae1be
commit a961a13be2
12 changed files with 349 additions and 14 deletions
+13
View File
@@ -1,6 +1,13 @@
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()],
@@ -9,6 +16,12 @@ export default defineConfig({
port: 5173,
watch: {
usePolling: true
},
proxy: {
'/api': {
target: proxyTarget,
changeOrigin: true
}
}
}
})