fix(config): keep page extensions out of module resolution#2594
Merged
james-elicx merged 2 commits intoJul 14, 2026
Conversation
commit: |
lyzno1
marked this pull request as ready for review
July 11, 2026 13:51
Contributor
Performance benchmarksCompared 0 improved · 0 regressed · 6 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pageExtensionsscoped to route discovery instead of merging it into Vite's globalresolve.extensionsturbopack.resolveExtensions, webpackresolve.extensions, and vinext's.cjs/.ctsconfig resolution behavior.tsx/.jspriority checkRoot cause
vinext merged
pageExtensionsinto Vite's module resolver. Withmdconfigured, an extensionless request such as/agentscould resolve to a rootagents.mdfile before the App Router handled the route. Depending on the Markdown contents, the request either returned transformed module content or failed during import analysis.Next.js keeps page-file discovery separate from module import resolution. Custom module extensions remain supported through
turbopack.resolveExtensionsor webpackresolve.extensions.The default resolver list is now independent from
pageExtensionswhile preserving vinext's existing.tsx,.ts,.jsx,.js,.mjspriority. This avoids an unrelated compatibility change and follows the default ordering used by Next.js 16 Turbopack for the overlapping extensions.Validation
vp test run tests/app-router-route-file-collision.test.ts tests/page-extensions-resolve.test.ts tests/init-cjs-config-resolve.test.ts tests/page-extensions-routing.test.tsvp test run tests/file-matcher.test.ts tests/next-config.test.ts tests/shims.test.ts -t 'pageExtensions|resolve extensions|resolveExtensions'vp check packages/vinext/src/index.ts packages/vinext/src/routing/file-matcher.ts tests/page-extensions-resolve.test.ts tests/app-router-route-file-collision.test.ts tests/fixtures/app-route-file-collision/next.config.mjs tests/fixtures/app-route-file-collision/app/agents/page.tsx tests/fixtures/app-route-file-collision/app/layout.tsxgit diff --checkScope
This removes collisions introduced by custom
pageExtensions. It does not change Vite's built-in extensionless resolution for its default JavaScript and TypeScript extensions.