- 新增双升(DoubleUp)完整实现:引擎 double-up-core.ts / double-up.ts、牌桌 UI DoubleUpBoard.tsx、单测与 E2E - 甩牌跟牌修复:validateFollow 新增 mixed 分支,甩牌后其他家可正常跟单张同花色牌 - start.sh:PORT=5173 单端口一键启动(Koa 同时 serve 页面+/api+/socket.io),浏览器直连无需 Vite 代理 - 玩家名 server 权威化(join 时写入 G.playerNames);LobbyRoomList 支持 fixedSeats(双升固定 4 人) - 文档:新增 dev-log/14、更新 dev-log README 索引与进度、更新根 README 启动/部署说明 - .gitignore 忽略根目录 data/*.db 运行时 SQLite
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vite';
|
||
import react from '@vitejs/plugin-react';
|
||
|
||
/**
|
||
* Vite dev 配置 —— 统一端口
|
||
*
|
||
* 浏览器只看到 :5173,所有 API / socket.io 都通过代理到内部 :8000:
|
||
* /api/games → http://localhost:8000/games
|
||
* /api/games/War/... → http://localhost:8000/games/War/...
|
||
* /socket.io/ → http://localhost:8000/socket.io/ (ws upgrade)
|
||
*
|
||
* LAN 部署时只需要放行 :5173 这一个端口。
|
||
*/
|
||
export default defineConfig({
|
||
plugins: [react()],
|
||
server: {
|
||
allowedHosts: ['playground.huajishe.fun'],
|
||
port: 5173,
|
||
strictPort: true,
|
||
host: '0.0.0.0', // LAN 可达
|
||
proxy: {
|
||
'/api': {
|
||
target: 'http://localhost:8000',
|
||
changeOrigin: true,
|
||
// 不 rewrite:保留 /api,让 server 端的 mountApiPrefix 处理
|
||
// /api/games → http://localhost:8000/api/games → server 剥 /api → /games
|
||
},
|
||
'/socket.io': {
|
||
target: 'http://localhost:8000',
|
||
ws: true,
|
||
changeOrigin: true,
|
||
},
|
||
},
|
||
},
|
||
build: {
|
||
outDir: 'dist',
|
||
sourcemap: true,
|
||
},
|
||
});
|