feat(game): update websocket URL configuration and improve game room logic - Change VITE_GAME_WS_URL from /api/v1/ws to /ws in .env.development - Update proxy configuration in vite.config.ts to match new websocket path - Refactor leave room functionality to properly disconnect websocket and destroy room state - Add e2e testing script to package.json ```
27 lines
688 B
TypeScript
27 lines
688 B
TypeScript
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
const apiProxyTarget = (env.VITE_API_PROXY_TARGET || 'http://127.0.0.1:19000').replace(/\/$/, '')
|
|
const wsProxyTarget = (env.VITE_WS_PROXY_TARGET || apiProxyTarget).replace(/\/$/, '')
|
|
|
|
return {
|
|
plugins: [vue()],
|
|
server: {
|
|
proxy: {
|
|
'/ws': {
|
|
target: wsProxyTarget,
|
|
changeOrigin: true,
|
|
ws: true,
|
|
rewriteWsOrigin: true,
|
|
},
|
|
'/api/v1': {
|
|
target: apiProxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|