Skip to content

Avoid loading route-pattern by default - #15463

Draft
brophdawg11 wants to merge 1 commit into
mainfrom
brophdawg11/codex-lazy-route-pattern
Draft

Avoid loading route-pattern by default#15463
brophdawg11 wants to merge 1 commit into
mainfrom
brophdawg11/codex-lazy-route-pattern

Conversation

@brophdawg11

Copy link
Copy Markdown
Contributor

This moves the route-pattern matcher behind a separate react-router/route-pattern entry point, so applications only include @remix-run/route-pattern when they opt into future.unstable_routePatternMatching.

import { unstable_routePatternMatching } from "react-router/route-pattern";

createBrowserRouter(routes, {
  future: { unstable_routePatternMatching },
});

In a production Vite bundle, the default path decreases from 32.82 kB to 26.43 kB gzip, avoiding 6.39 kB for applications that do not opt in. Regression coverage verifies the default router entry does not load the route-pattern modules.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Preview Build Available

Preview builds have been created for this PR. You can install react-router using:

pnpm install "remix-run/react-router#preview/pr-15463&path:packages/react-router"

And/or install other packages via:

pnpm install "remix-run/react-router#preview/pr-15463&path:packages/react-router-dev"
pnpm install "remix-run/react-router#preview/pr-15463&path:packages/react-router-express"
pnpm install "remix-run/react-router#preview/pr-15463&path:packages/react-router-node"
pnpm install "remix-run/react-router#preview/pr-15463&path:packages/react-router-serve"

These preview builds will be updated automatically as you push new commits.

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.

1 participant