import react from '@vitejs/plugin-react'; import path from 'path'; import { defineConfig, loadEnv } from 'vite'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, '.', ''); const isProduction = mode === 'production'; return { server: { port: 3000, host: '0.0.0.0', // Force HTTPS in production builds https: isProduction ? true : false, proxy: { '/auth': { target: isProduction ? env.VITE_API_BASE_URL || 'https://api.bugulma.city' : 'http://localhost:8080', changeOrigin: true, secure: isProduction, // Verify SSL certificates in production }, '/api': { target: isProduction ? env.VITE_API_BASE_URL || 'https://api.bugulma.city' : 'http://localhost:8080', changeOrigin: true, secure: isProduction, // Verify SSL certificates in production }, '/static': { target: isProduction ? env.VITE_API_BASE_URL || 'https://api.bugulma.city' : 'http://localhost:8080', changeOrigin: true, secure: isProduction, // Verify SSL certificates in production }, }, }, plugins: [react()], define: { 'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY), 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY), }, resolve: { alias: { '@': path.resolve(__dirname, '.'), }, }, }; });