Skip to content

Commit 17ee18e

Browse files
committed
chore: add changeset for Next.js 16.2.x compatibility fixes
1 parent 708c30b commit 17ee18e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.changeset/next-16-2-compat.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
Add Next.js 16.2.x compatibility patches
6+
7+
- **`perf_hooks` shim**: Next 16.2.x's `gc-observer` and `@vercel/otel` import `PerformanceObserver` / `performance` from `node:perf_hooks`, which Cloudflare Workers does not expose. A new shim re-exports `globalThis.performance` and provides a no-op `PerformanceObserver`, resolved via a new `shimNodeModules` onResolve plugin.
8+
- **`fast-set-immediate` shim**: Next 16.2's app-render scheduler imports `next/dist/server/node-environment-extensions/fast-set-immediate.external`, whose `install()` mutates the frozen `node:timers` module on load and throws "Cannot assign to read only property 'setImmediate'". A shim replaces the module with no-op control functions; the scheduler optimization is not needed in Workers. The bundle banner also exposes `AsyncLocalStorage` on `globalThis` so Next's check picks up the real implementation rather than the throwing fallback.
9+
- **`patchPageExports` plugin**: Next 16.2.x Turbopack templates set `handler` on a child module via `esmExport(bindings, childId)` then re-call `esmExport` for the entry id. Each page chunk's `module.exports = R.m(<entryId>).exports` then lacks `handler`, causing "ComponentMod.handler is not a function" on every app route. A new build-time plugin scans the SSR template chunks to discover entry→child mappings and rewrites each page.js / route.js terminator to merge the child's own-property descriptors over the entry's, exposing `handler` without touching the Turbopack runtime.
10+
11+
Related: #1258

0 commit comments

Comments
 (0)