Skip to content

feat(react-router): Capture server build in dev mode for middleware names#22631

Open
chargome wants to merge 1 commit into
developfrom
feat/rr-dev-server-build-capture
Open

feat(react-router): Capture server build in dev mode for middleware names#22631
chargome wants to merge 1 commit into
developfrom
feat/rr-dev-server-build-capture

Conversation

@chargome

@chargome chargome commented Jul 24, 2026

Copy link
Copy Markdown
Member

The server build capture Vite plugin gated on config.build.ssr, which is only true during a production build — so react-router dev never captured the server build, and middleware names were missing in development.

Gates on the transform hook's options.ssr flag instead, which is set for the SSR module in both dev and production builds.

To cover this, the react-router-7-framework-instrumentation e2e app now runs against both the production server and the dev server (react-router dev) via TEST_ENV, rather than adding a separate app. A few assertions were adjusted for dev mode: pageload/navigation URLs accept the trailing-slash difference (prod's react-router-serve redirects the bare index route, the dev server does not), and the double-instrumentation and action-error tests are skipped in dev (the Vite dev server serves source modules as extra requests, and the action error races the client instrumentation path).

Fixes #22592

…ames

Gate the server build capture Vite plugin on the transform hook's `options.ssr`
flag instead of `config.build.ssr`. `options.ssr` is set for the SSR module in
both `react-router dev` and production builds, so middleware names now resolve in
dev mode too (previously the build-only gate skipped dev entirely).

Run the instrumentation e2e app against both the production and dev servers via
`TEST_ENV`, and stabilize the suite for dev mode (trailing-slash URL differences,
dev-only skips for the double-instrumentation and action-error assertions).

Fixes #22592

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chargome chargome self-assigned this Jul 24, 2026
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f8eacbf. Configure here.

@chargome
chargome marked this pull request as ready for review July 24, 2026 14:45
@chargome
chargome requested a review from a team as a code owner July 24, 2026 14:45
@chargome
chargome requested review from mydea and nicohrubec and removed request for a team July 24, 2026 14:45
@chargome

Copy link
Copy Markdown
Member Author

@nicohrubec last RR pr I promise

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capture React Router server build in dev mode for middleware names

2 participants