File size: 989 Bytes
4e909c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// Get API URL from environment or use defaults
// In vite.config.ts, we're in Node.js context, so process.env is available
declare const process: { env: { VITE_API_URL?: string } };
const API_URL = process.env.VITE_API_URL || 'http://localhost:8000';
const WS_URL = API_URL.replace(/^http/, 'ws');
export default defineConfig({
plugins: [react()],
server: {
host: '0.0.0.0',
port: 5173,
proxy: {
'/api': {
target: API_URL,
changeOrigin: true,
},
'/ws': {
target: WS_URL,
ws: true,
changeOrigin: true,
}
}
},
build: {
outDir: 'dist',
emptyOutDir: true,
sourcemap: false,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom', 'react-router-dom'],
charts: ['recharts'],
}
}
}
},
preview: {
port: 5173,
host: '0.0.0.0'
}
}) |