import tailwindcss from '@tailwindcss/vite'; import react from '@vitejs/plugin-react'; import path from 'path'; import {defineConfig, loadEnv} from 'vite'; export default defineConfig(({mode}) => { const env = loadEnv(mode, '.', ''); return { plugins: [react(), tailwindcss()], resolve: { alias: { '@': path.resolve(__dirname, '.'), }, }, server: { watch: { ignored: ['**/history.json'] }, // Set DISABLE_HMR=true in .env to turn off hot module replacement. hmr: process.env.DISABLE_HMR !== 'true', proxy: { '/api/search': { target: 'http://localhost:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api\/search/, '/search'), }, '/api/evaluate': { target: 'http://localhost:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api\/evaluate/, '/evaluate'), }, '/api/health': { target: 'http://localhost:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api\/health/, '/health'), }, '/api/stats': { target: 'http://localhost:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api\/stats/, '/stats'), }, '/api/explain': { target: 'http://localhost:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api\/explain/, '/explain'), }, }, }, }; });