fix(patches): include prefetch-hints.json in loadManifest glob for Next.js 16.2#1160
Merged
petebacondarwin merged 2 commits intoopennextjs:mainfrom Mar 23, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 8dfcca3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4 tasks
commit: |
conico974
approved these changes
Mar 21, 2026
Collaborator
conico974
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix, could you just fix the prettier check please ?
HazemKhaled
added a commit
to HazemKhaled/evisa
that referenced
this pull request
Mar 21, 2026
bfef748 to
8dfcca3
Compare
Contributor
Author
|
Thanks @conico974 and @sommeeeer for the quick review! I just pushed a fix for formatting. It looks like I don't have permissions to merge this PR on my end. Y'all mind pressing "Squash & Merge" for me (or whatever merge option you prefer)? |
Merged
2 tasks
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.
Problem
Next.js 16.2.0 introduced
prefetch-hints.json, a new server manifest loaded unconditionally byNextNodeServer.getPrefetchHints(). The file exists in.next/server/and is listed inrequired-server-files.json, but the glob pattern inload-manifest.tsonly matches*-manifest.jsonandrequired-server-files.json— so no if/else branch is generated for it and the patchedloadManifest()throws at runtime:Why this is needed alongside #1151
PR #1151 adds graceful
return {}fallbacks for optional manifests — ones Next.js loads withhandleMissing: true(e.g.subresource-integrity-manifest.json,react-loadable-manifest.json). Those files may or may not exist at build time, and Next.js handles missing responses gracefully.prefetch-hints.jsonis different: it is a required manifest that always exists in the build output and is loaded withouthandleMissing: true. It simply doesn't match the*-manifest.jsonglob pattern because its filename doesn't end with-manifest. The correct fix is to include it in the glob so its contents are inlined at build time, not to return an empty object at runtime.Fix
Add
prefetch-hintsto the existing glob alternation inload-manifest.ts. This follows the same pattern used whenrequired-server-fileswas added to the glob. Backwards compatible with Next.js 15/16.1.x where the file doesn't exist (glob simply finds no match).Fixes #1157. Related: #1141, #1151.