Skip to content

fix: pass --conditions as argv when relaunching the dev CLI - #15435

Open
official-burak wants to merge 2 commits into
remix-run:mainfrom
official-burak:fix/restart-conditions-argv
Open

fix: pass --conditions as argv when relaunching the dev CLI#15435
official-burak wants to merge 2 commits into
remix-run:mainfrom
official-burak:fix/restart-conditions-argv

Conversation

@official-burak

@official-burak official-burak commented Aug 25, 2026

Copy link
Copy Markdown

Fixes #15433

Changelog

react-router dev relaunches itself with --conditions=development so the package imports map resolves the development build. Since 8.3.0 that relaunch put the flag in NODE_OPTIONS. Node honors that. Bun does not: it keeps the env var but never applies --conditions, so #development-condition-enabled stays false, dev() restarts a second time, and the already-restarted guard throws.

Description

Pass the extra flags on argv immediately after the runtime binary (node --conditions=development … / bun --conditions=development …) and stop writing them into NODE_OPTIONS. Existing NODE_OPTIONS from the user are still inherited. The already-restarted guard is unchanged.

Test evidence

Fail-then-pass on packages/react-router-dev/__tests__/restart-with-conditions-test.ts:

  • before: spawn args had no --conditions flag; it was merged into NODE_OPTIONS
  • after: --conditions=development is args[0]; caller NODE_OPTIONS is left alone

pnpm test packages/react-router-dev/: 10 suites, 190 tests passed.

Local Bun check matching the issue: NODE_OPTIONS=--conditions=development bun --bun leaves the flag in the environment but not in process.execArgv. bun --bun --conditions=development puts it on execArgv.

Bun ignores --conditions in NODE_OPTIONS, so the 8.3.0 restart looped
and threw. Put the flag on argv instead, which both Node and Bun honor.
@official-burak
official-burak force-pushed the fix/restart-conditions-argv branch from f29d94d to e599015 Compare August 25, 2026 17:39
Chromium CI expected one relaunch, but restartCount still looked for NODE_OPTIONS and stayed at 0 after the server started.
@official-burak
official-burak force-pushed the fix/restart-conditions-argv branch from e599015 to 95f74b5 Compare August 25, 2026 17:40
@official-burak

Copy link
Copy Markdown
Author

Pushed 95f74b5 for the Chromium failure on cli › dev restarts with the development condition and starts the server.

waitForDevServer already succeeded. restartCount still matched Relaunching with NODE_OPTIONS:, while the relaunch line is now Relaunching with --conditions=development, so the count stayed at 0. The matcher now keys off Relaunching with .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8.3.0: react-router dev throws under the Bun runtime because --conditions is passed via NODE_OPTIONS

2 participants