Env-driven dev ports + splash as the front door

vite.config.ts now reads WEB_PORT (Vite) and PORT (API) from .env via
loadEnv, with the /api proxy following PORT and strictPort on — so two
branch checkouts can each run `npm run dev` on their own ports.

Play now always lands on the splash at the bare root instead of silently
resuming an active playthrough; a Resume action continues one when present.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-22 15:43:08 +02:00
co-authored by Claude Opus 4.8
parent 34aa23237e
commit cd4b8bf4fa
3 changed files with 32 additions and 10 deletions
+16 -7
View File
@@ -1,10 +1,19 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
proxy: { '/api': 'http://127.0.0.1:8787' },
},
// Ports are read from .env so two branch checkouts can run `npm run dev` side by
// side: give each folder its own WEB_PORT (Vite) and PORT (API). The /api proxy
// follows PORT so the web server always talks to its own backend.
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const webPort = Number(env.WEB_PORT || 5173)
const apiPort = Number(env.PORT || 8787)
return {
plugins: [react()],
server: {
port: webPort,
strictPort: true, // fail loudly on a clash instead of silently picking another port
proxy: { '/api': `http://127.0.0.1:${apiPort}` },
},
}
})