import react from '@vitejs/plugin-react'; import { defineConfig, loadEnv } from 'vite'; const env = loadEnv('', process.cwd()); const configuredAllowedHosts = env.VITE_ALLOWED_HOSTS ? env.VITE_ALLOWED_HOSTS.split(',').map((host) => host.trim()) : []; const allowedHosts = Array.from( new Set(['localhost', '127.0.0.1', '192.168.7.45', ...configuredAllowedHosts].filter(Boolean)) ); export default defineConfig({ plugins: [react()], server: { allowedHosts: allowedHosts, watch: { usePolling: true, }, host: true, strictPort: true, proxy: { '/api': { target: 'http://localhost:5000', changeOrigin: true, secure: false, }, }, }, })