Skip to content

Commit 161e726

Browse files
authored
fix(patches): include prefetch-hints.json in loadManifest glob for Next.js 16.2 (#1160)
* fix(patches): include prefetch-hints.json in loadManifest glob for Next.js 16.2 * style: fix prettier formatting in load-manifest.ts
1 parent 7ccf5ea commit 161e726

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix(patches): include `prefetch-hints.json` in loadManifest build-time inlining
6+
7+
Next.js 16.2.0 introduced `prefetch-hints.json` as a new server manifest loaded unconditionally
8+
by `NextNodeServer.getPrefetchHints()`. The file exists in the build output but wasn't matched by
9+
the glob pattern `*-manifest.json`, causing the patched `loadManifest()` to throw at runtime.

packages/cloudflare/src/cli/build/patches/plugins/load-manifest.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ async function getLoadManifestRule(buildOpts: BuildOptions) {
3737
const baseDir = join(outputDir, "server-functions/default", getPackagePath(buildOpts));
3838
const dotNextDir = join(baseDir, ".next");
3939

40-
const manifests = await glob(join(dotNextDir, "**/{*-manifest,required-server-files}.json"), {
41-
windowsPathsNoEscape: true,
42-
});
40+
const manifests = await glob(
41+
join(dotNextDir, "**/{*-manifest,required-server-files,prefetch-hints}.json"),
42+
{
43+
windowsPathsNoEscape: true,
44+
}
45+
);
4346

4447
const returnManifests = (
4548
await Promise.all(

0 commit comments

Comments
 (0)