fix(build): support _inlined segment paths in prefetchInlining for dynamic routes#90850
Closed
bensalmon-daylight wants to merge 2 commits intovercel:canaryfrom
Closed
Conversation
Collaborator
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
acdlite
added a commit
that referenced
this pull request
Mar 5, 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>
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.
What
Handle
_inlinedsegment paths during the build whenprefetchInliningis enabled alongside dynamic routes.Why
When
prefetchInliningis enabled, segment data is bundled into/_inlinedinstead of per-segment/__PAGE__entries. The build previously only looked for__PAGE__insegmentPaths, throwingInvariant: missing __PAGE__ segmentPathfor any dynamic route usingprefetchInlining.How
/_inlinedas a fallback when/__PAGE__is not found insegmentPaths/_inlined,/_tree,/_full, and bare.segment.rscURLs__PAGE__nor_inlinedis presentTest Plan
test/production/app-dir/prefetch-inlining-dynamic-routes/) with a dynamic[slug]route andprefetchInlining: trueInvariant: missing __PAGE__ segmentPath)Relevant PR
#90555