perf(dev): 6.5x faster dev boot + fix Windows spawn ENOENT#196
Open
Zen0-99 wants to merge 3 commits into
Open
Conversation
- React Compiler: run in build only (was adding a full compiler pass to every module transform in dev, ~45s first-load cost) - Preload the editor body chunk in parallel with page render; skip the 9 sibling workspace-page prewarms in dev (they forced ~20s of transforms and starved the editor) - freePort: add Windows netstat/tasklist fallback - dev.ts: resolve bun via process.execPath and other bins via Bun.which so child spawns don't ENOENT on Windows shims
On Windows the launched 'bun' is a .cmd shim (Bun.spawn(['bun',...]) -> ENOENT) and 'vite' is not on the child's PATH (Bun.which('vite') is null). Resolve both through process.execPath: bun for its own entry, bun executing node_modules/vite/bin/vite.js for the dev server.
Adopt upstream CoreBunch#193's bunCommand/bunRunCommand helpers (process.execPath-based, same Windows fix) for child spawning; drop the now-redundant resolveCommand. Keep the Windows netstat/tasklist fallback in freePort.findPortHolders (superior to upstream's skip-on-Windows) and fix the re-probe loop's sleep spawn, which ENOENT'd on Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Measured result: dev boot 47.7s -> 7.4s (6.5x).
Why
bun run dev presented two waits: a ~20s waiting screen before the admin UI painted, then a second wait for the editor chunk ("Editor is still loading - Retry"). An instrumented boot corridor showed the dominant cost was Vite's per-module transform in dev - largely the React Compiler babel pass on every module every start - plus the editor chunk being fetched serially after first paint and the sibling workspace pages being prewarmed up front. Separately, the Windows spawn bug (a .cmd shim) blocked bun run dev entirely with ENOENT.
Test