Patch Changes
-
#1505
2bc929eThanks @vicb! - chore: bump@opennextjs/awsto 4.2.0See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.2.0
- Honor
dangerous.disableTagCachewhen reading"use cache"entries. - Queue one revalidation per stale cache entry.
- Add an experimental
onTagCacheResultcallback to entries returned by the incremental cache.
- Honor
-
#1492
c41442bThanks @jorgemoya! - perf: read each tag once per request in the sharded Durable Object tag cacheWith
doShardedTagCache, cached pages could take up to about a second longer to render, mostly on low-traffic sites. Every cachedfetchor"use cache"entry on a page checked its tags separately, so the same tags were read from the Durable Objects many times per render.Each tag is now read once per request, which cuts Durable Object reads, and their cost, on pages with many cached entries.
-
#1498
2fd94f6Thanks @haranishi! - fix: deduplicate inline CSS in the Worker bundleWhen
experimental.inlineCssis enabled, the same stylesheet can repeat across client reference manifests. OpenNext shares repeated inline CSS strings in the Worker bundle, reducing upload size. -
#1417
3d7a137Thanks @Adnan-Husayn! - fix: forward an empty--envto wrangler--env=""is how Wrangler recommends targeting the top-level environment when the configuration also defines named environments. The flag was dropped before reaching Wrangler, so the command behaved as if no environment had been specified: the "Multiple environments are defined in the Wrangler configuration file" warning persisted and, whenCLOUDFLARE_ENVwas set, Wrangler targeted that environment instead of the top-level one.The empty environment is now forwarded to every Wrangler command, including the ones used to populate the cache.
-
#1353
780d32cThanks @uttkarsh-26! - fix: declare esbuild as a dependencyopennextjs-cloudflare buildimportsesbuild, but the package only listed it in itsdevDependencies. The import resolved only when the package manager happened to hoist the copy installed by@opennextjs/awsorwrangler. When another package claimed that slot, or withnpm cion a lockfile markingesbuildas extraneous, the build failed withERR_MODULE_NOT_FOUND: Cannot find package 'esbuild'.esbuildis now a dependency, pinned to the version@opennextjs/awsuses. -
#1432
e751dd8Thanks @mathurshubham! - fix: exportpackage.jsonfrom@opennextjs/cloudflarerequire.resolve("@opennextjs/cloudflare/package.json")threwMODULE_NOT_FOUNDbecause the./*export mapped it to a file that does not exist. Tools that read dependency manifests reported the package as missing, for example Storybook printedWARN unable to find package.json for @opennextjs/cloudflare. -
#1499
95d7f52Thanks @haranishi! - perf: load Wrangler on demand in the CLIThe CLI now starts help and version commands without loading Wrangler and Miniflare. Commands that use Wrangler still load it when they read configuration, get bindings, or start an R2 cache worker.
-
#1442
f0efe83Thanks @mathurshubham! - fix: do not importwranglertypes from the public type declarationsProjects compiled with
skipLibCheck: falsefailed to type-check with errors insidenode_modules/wranglerandnode_modules/miniflare(e.g.TS2307: Cannot find module '@cloudflare/workers-utils'). The adapter's declarations importedGetPlatformProxyOptionsfromwrangler, which pulled in wrangler's own declarations, and those do not type-check (cloudflare/workers-sdk#15940). The options ofinitOpenNextCloudflareForDevare now declared in the adapter, so its declarations no longer referencewrangler. -
#1489
f5a2d09Thanks @vicb! - fix: reduce the Node.js middleware (proxy.ts) bundle size and resolve its packages like the serverA
proxy.ts(or amiddleware.tsusing the Node.js runtime) produced a much larger Worker than the same code in an edgemiddleware.ts(#1373). With Next.js 16.4, the middleware bundle of a proxy only usingnext/serveris now ~40% smaller. A proxy importing React (directly or through a library likenext/og) still bundles the Next.js app page runtime.It also fixes these build errors:
Could not resolve "#util"(and similar) wheninstrumentation.tsimports a package with conditional imports (#1401). The instrumentation hook is no longer bundled in the middleware.Could not resolve "cloudflare:sockets"when the middleware imports a package whoseworkerdbuild usescloudflare:*modules, i.e.postgres4 (#1487).
The esbuild metafile is now written to
.open-next/middleware/handler.mjs.meta.jsonto help analyze the bundle size. -
#1462
dcffe69Thanks @medlabib! - fix: add a default export to the@next/envshimPayload 3.x (
payload/dist/bin/loadEnv.js) imports@next/envwith a default import, so bundling a Payload app failed with:No matching export in ".open-next/cloudflare-templates/shims/env.js" for import "default"The shim now has a default export, and
loadEnvConfigreturns the same shape as@next/env({ combinedEnv, parsedEnv, loadedEnvFiles }) so callers destructuring the result no longer throw.It still does not load any file:
process.envis populated at runtime from the Worker bindings and the.env*files compiled at build time for theNEXTJS_ENVmode. -
#1504
68fc728Thanks @vicb! - chore: warn at build time when Cache Components are enabledCache Components (
cacheComponents: trueinnext.config) are not fully supported on Cloudflare yet. Apps that enable them now get a build warning linking to #1318, where support is being tracked.