Fix prefetch inlining build failure with dynamic routes#90899
Merged
acdlite merged 1 commit intovercel:canaryfrom Mar 5, 2026
Merged
Fix prefetch inlining build failure with dynamic routes#90899acdlite merged 1 commit intovercel:canaryfrom
acdlite merged 1 commit intovercel:canaryfrom
Conversation
Collaborator
Failing test suitesCommit: 3e73cd1 | About building and testing Next.js
Expand output● hmr-intercept-routes › should update intercept routes via HMR
Expand output● Dev Rendering Indicator › Shows build indicator when page is built from modifying |
Contributor
|
Looks good, my email is actually ben.salmon@daylightgroup.nz though. |
Contributor
Author
|
Ahaha maybe Claude hallucinated the email |
When prefetchInlining is enabled, the segment data collection returns a special key for the inlined response. Previously this key was `/_inlined`, but the build validation code in `packages/next/src/build/index.ts` expects segment paths to contain `__PAGE__`. This caused builds to fail with "Invariant: missing __PAGE__ segmentPath" for any dynamic route using prefetchInlining. Fix by using the same `PAGE_SEGMENT_KEY` (`__PAGE__`) constant for the inlined segment response key, matching what the build code already expects. This is consistent since the inlined response serves the same role as the per-page segment data — it just bundles all segments together. Co-authored-by: Ben Salmon <ben.salmon@daylightgroup.nz>
8b399af to
3e73cd1
Compare
sokra
pushed a commit
that referenced
this pull request
Mar 6, 2026
When prefetchInlining is enabled, the segment data collection returns a special key for the inlined response. Previously this key was `/_inlined`, but the build validation code in `packages/next/src/build/index.ts` expects segment paths to contain `__PAGE__`. This caused builds to fail with "Invariant: missing __PAGE__ segmentPath" for any dynamic route using prefetchInlining. Fix by using the same `PAGE_SEGMENT_KEY` (`__PAGE__`) constant for the inlined segment response key, matching what the build code already expects. This is consistent since the inlined response serves the same role as the per-page segment data — it just bundles all segments together. Closes #90850 Co-authored-by: Ben Salmon <ben.salmon@daylightgroup.nz> Co-authored-by: Ben Salmon <ben.salmon@daylightgroup.nz>
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.
When prefetchInlining is enabled, the segment data collection returns a special key for the inlined response. Previously this key was
/_inlined, but the build validation code inpackages/next/src/build/index.tsexpects segment paths to contain__PAGE__. This caused builds to fail with "Invariant: missing PAGE segmentPath" for any dynamic route using prefetchInlining.Fix by using the same
PAGE_SEGMENT_KEY(__PAGE__) constant for the inlined segment response key, matching what the build code already expects. This is consistent since the inlined response serves the same role as the per-page segment data — it just bundles all segments together.Closes #90850
Co-authored-by: Ben Salmon ben.salmon@daylightgroup.nz