pnpm dev boots a blank window — vite dev server externalizes the renderer's node builtins (#233's bridge is build-only) #345
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#345
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom.
pnpm dev(the documented dev flow: vite dev server on :5173 +OURCLOUD_DEV_SERVER_URL) opens an empty white window. The renderer page loads (kit CSS present) but the composition never mounts.Evidence. Renderer pageerror, reproduced 2026-08-08 driving the dev app under Playwright:
Root cause. The composition spawns the helper in the renderer over
node:child_process(stdioBridge, ADR 0108's node-integrated renderer). Issue #233 fixed exactly this for the built renderer withvite-plugin-electron-builtins.ts(electronRendererBuiltins()), which compiles each builtin import to a runtimerequire. But that plugin isapply: 'build'— undervite dev/serve, vite's own browser-external shim takes over and throws on first access, so the dev-served renderer can never spawn the helper. (The plugin's header claims builtins "resolve under Vite's dev server" — true for vitest's Node environment, not for a served Chromium page.)Fix sketch. Let the bridge apply in serve mode too (drop
apply: 'build'and makeresolveId/loadcover the dev server's__vite-browser-externalpath), or an equivalent serve-mode alias. Acceptance:pnpm dev:renderer+pnpm devboots to Welcome with the helper spawned, and the #233 guard test still passes for the built renderer.Workaround used meanwhile (works today): build the renderer and serve
dist/statically on the same port —pnpm build:renderer && python3 -m http.server 5173 --directory dist— then launch dev electron as usual (OURCLOUD_DEV_SERVER_URL=http://localhost:5173,OURCLOUD_DEV_HELPER_BIN=$PWD/.dev/helper-dev).Found during the S12 design-verify arc (merge
df66d03).Fixed in
a466a49(on origin/main).Root cause confirmed:
electronRendererBuiltins()(#233) wasapply: 'build', so undervite dev/serve vite's browser-external shim resolvednode:child_processto a Proxy that throws on first access — the dev-served renderer never mounted (blank window).Fix: drop
apply: 'build'so the bridge applies in both serve and build. Itsenforce: 'pre'resolveIdalready runs before vite's core resolver, so it now intercepts every builtin before the shim can claim it in serve mode too — the samerequire-bridge the packaged build uses. Corrected the header's false claim that builtins "resolve under Vite's dev server".Guard: new
app/tests/unit/rendererDevBoot.test.tsdrives the REAL vite dev server's plugin container and asserts each composition builtin (node:child_process/node:fs/promises/node:path/node:process) resolves to the require bridge, never vite's browser-external module (red before the fix, green after). The #233 built-renderer guard (rendererBuild.test.ts) still passes. Full appvitest rungreen but for the pre-existinggo-on-PATH boot suite (spawnSync go ENOENT).