fix: wait for Vite dev server before launching Electron (#9777)

Use wait-on to poll tcp:3334 so Electron only starts after the Vite
dev server is ready, preventing ERR_CONNECTION_REFUSED on startup.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yaoweiprc
2026-04-07 17:33:30 +08:00
committed by GitHub
parent 9df6cafd25
commit fdddbee99f

View File

@@ -30,7 +30,7 @@
"start": "npx -y concurrently -n browser,main --kill-others \"npm run start:dev-server\" \"npm run start:electron\"",
"start:autoRestart": "npx -y concurrently -n browser,main --kill-others \"npm run start:dev-server\" \"npm run start:electron:autoRestart\"",
"start:dev-server": "vite dev",
"start:electron": "cross-env NODE_ENV=development esr esbuild.entrypoints.ts && electron --inspect=5858 .",
"start:electron": "cross-env NODE_ENV=development esr esbuild.entrypoints.ts && npx -y wait-on tcp:3334 && electron --inspect=5858 .",
"start:electron:autoRestart": "cross-env NODE_ENV=development esr esbuild.entrypoints.ts --autoRestart",
"test": "vitest run",
"type-check": "react-router typegen && tsc --project tsconfig.json",