import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' export default defineConfig({ plugins: [ react(), tailwindcss(), ], build: { /** * Objektbilder bleiben immer eigene Dateien. * * Vite bettet Assets unter 4 KB als Base64 ein. Zwei der Objektbilder liegen * knapp darunter und landeten dadurch im JavaScript statt im Dateisystem — * werden sie später durch echte Fotos ersetzt, sollen alle Objekte gleich * behandelt sein. Für alle übrigen Assets bleibt die Voreinstellung. */ assetsInlineLimit: (filePath: string) => filePath.includes('/assets/properties/') ? false : undefined, }, server: { proxy: { // In dev: forward /api/* to the local PowerOn backend. // Set AI_BACKEND_URL in your shell or .env.local (no VITE_ prefix — never bundled). // Example: AI_BACKEND_URL=http://localhost:3001 // // In production: the same-origin backend serves /api/* directly. // No proxy needed; the relative URL /api/ai/chat/completions resolves correctly. '/api': { target: process.env['AI_BACKEND_URL'] ?? 'http://localhost:3001', changeOrigin: true, }, }, }, })