Spaces:
Sleeping
Sleeping
| import { defineConfig, loadEnv } from 'vite'; | |
| import react from '@vitejs/plugin-react'; | |
| import path from 'path'; | |
| export default defineConfig(({ mode }) => { | |
| const env = loadEnv(mode, process.cwd(), ''); | |
| const apiProxyTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:8000'; | |
| const wsProxyTarget = env.VITE_WS_PROXY_TARGET || 'ws://localhost:8000'; | |
| return { | |
| plugins: [react()], | |
| resolve: { | |
| alias: { | |
| '@': path.resolve(__dirname, './src'), | |
| }, | |
| }, | |
| server: { | |
| host: true, | |
| port: 3000, | |
| proxy: { | |
| '/api': { | |
| target: apiProxyTarget, | |
| changeOrigin: true, | |
| }, | |
| '/ws': { | |
| target: wsProxyTarget, | |
| ws: true, | |
| }, | |
| }, | |
| }, | |
| test: { | |
| globals: true, | |
| environment: 'jsdom', | |
| setupFiles: ['./src/test/setup.ts'], | |
| }, | |
| }; | |
| }); | |