Repository navigation
Fix frontend dev server start on bun-only Windows installs - #7895
Conversation
`react-router dev` needs the `development` export condition and relaunches
itself to enable it. On Windows with bun and no Node, the relaunched process
receives the flag but still does not apply the condition, so the CLI tries to
relaunch a second time and trips its restart guard:
error: restartWithMergedOptions() was called, but the process has already
been restarted.
When bun is the runtime (no Node, or an outdated one), run the CLI through
`bun --conditions=development run --bun react-router dev --host` instead of
`bun run dev`, so bun applies the condition itself and the CLI never
relaunches. With a supported Node the command is unchanged: Node reads the
condition from NODE_OPTIONS.
`run_frontend` and AppHarness share the new `_frontend_dev_command` helper.
Fixes #7894
[Medium impact] The change reaches development frontend startup in normal runs and app harnesses. The test assertion must satisfy the repository’s exact-value requirement before merging. Findings
SummaryThe PR shares the frontend start command between
Reviews (2) · Last reviewed commit: "fix(exec): keep run_process_and_launch_u..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Merging this PR will regress 1 benchmark2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
…odeless test's node probe Sequence[str | None] did not match new_process's list overloads, so pyright failed. The nodeless integration test now asserts the dev server got the development condition flag and stubs the per-process node probe, so an earlier test that found node cannot switch it back to `bun run dev`.
Type of change
What
On Windows with bun and no Node.js,
reflex runcould not start the frontend:react-router devneeds thedevelopmentexport condition and relaunches itself to enable it.NODE_OPTIONSonly reaches real Node, so a bun-only install depends on that relaunch. On Windows the relaunched process receives the flag but still does not apply the condition, so the CLI tries to relaunch again and trips its guard.Fix
When bun is the runtime (no Node, or an outdated one), the dev server is started with
instead of
bun run dev. Bun applies the condition itself, so the CLI never relaunches. With a supported Node installed the command is unchanged (bun run dev/npm run dev), and Node still reads the condition fromNODE_OPTIONS.run_frontendandAppHarnessnow share a private_frontend_dev_command()helper inreflex/utils/exec.py. The script is taken fromconstants.PackageJson.Commands.DEVrather than a hardcoded path into@react-router/dev.Testing
On Windows 11, bun 1.4.4, no Node, react-router 8.4.0:
tests/integration/test_nodeless_frontend.pyfailed before the change with the error above and passes after. It also asserts that the dev server got--conditions=development, so it checks the new command on Linux CI too, wherebun run devalready worked. Its fixture stubs the per-process node probe, so an earlier test that found node cannot change the command.test_frontend_dev_commandpins the exact command for each runtime case.reflex runon a minimal app starts and serves the page.ruff checkandruff formatare clean.Reviewer notes
bun run devalready worked; I could only test Windows, so CI's node-less integration test is the coverage there.bun --bun run devand now takes the same direct form. That path is only unit-tested.run_process_and_launch_urlnow takeslist[str]instead oflist[str | None]. No caller passesNone, andnew_processalready exits on aNoneargument.node.exeignores the flag on relaunch is not investigated; this sidesteps it.closes #7894