Enable strict route matching by default (#97397)
## Summary This enables strict route matching by default. App Router URLs that cannot construct a complete route tree are rejected, unreachable pages are reported, and incomplete catch-all matchers are pruned. If strict route matching finds one of these invalid route structures, Next.js warns that the validation implies a bug in the app and points to `deprecated.looseRouteMatching: true` as a temporary escape hatch. The deprecated option only accepts `true`; strict matching remains the normalized internal behavior when the option is absent. For example, this layout cannot render either URL as a complete route because neither named slot has a page or default for the URL matched by its sibling: ```text app/ ├── layout.tsx ├── @left/foo/page.tsx └── @right/bar/page.tsx ``` Previously the app could depend on soft navigation preserving stale slot state even though `/foo` and `/bar` could not be loaded directly. With strict route matching enabled, the build reports the incompatible slots and the two unreachable pages. Adding explicit defaults makes the intended fallback behavior valid again. ## Verification - `pnpm build-all` - `pnpm exec jest packages/next/src/server/config.test.ts --runInBand` - `parallel-routes-pruned-matchers` in production with Turbopack and Webpack - `parallel-routes-leaf-segments` in production with Turbopack - strict diagnostic fixtures in production with Turbopack <!-- NEXT_JS_LLM -->
Showing
Please
register
or
sign in
to comment