import { defineConfig, loadEnv } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'node:path'; export default defineConfig(({ mode }) => { const rootDir = path.resolve(__dirname, '..'); const env = loadEnv(mode, rootDir, ''); const clientPort = Number(env.CLIENT_PORT) || 5173; const proxyTarget = env.API_PROXY_TARGET || 'http://localhost:3000'; return { plugins: [react()], server: { port: clientPort, proxy: { '/api': proxyTarget } } }; });