---
title: "Next.js 16.5: what changes and what breaks from 16.4"
description: "Next.js 16.5.0 (2 Dec 2026) turns on Turbopack GC and cross-deployment use cache keys by default. What breaks from 16.4.6, and what to check before 15 Dec."
canonical_url: "https://www.outofplace.space/blog/nextjs-16-5-release"
language: "en"
last_updated: "2026-12-05"
alternates:
  pl: "https://www.outofplace.space/pl/blog/nextjs-16-5-co-nowego-aktualizacja.md"
---

# Next.js 16.5: what changes and what breaks from 16.4

> Next.js 16.5.0 (2 Dec 2026) turns on Turbopack GC and cross-deployment use cache keys by default. What breaks from 16.4.6, and what to check before 15 Dec.

Published 2026-12-05 · Category: Next.js & React · Tags: Next.js, Turbopack, Caching

Next.js 16.5.0 came out on 2 December 2026 and is now npm's `latest`. For a team on 16.4.6, the upgrade changes four things by default. Turbopack garbage collection is on. Turbopack minifies modules before chunking them. `next build` stops when `NODE_ENV=development`. And `'use cache: remote'` entries can survive a deploy, because Turbopack production builds now key them on the function's code and the environment variables it reads instead of the build ID. `experimental.lockDistDir` is gone. Node.js (`>=20.9.0`) and React don't change. Upgrade this month: the [security release on 15 December](https://nextjs.org/blog/upcoming-nextjs-security-release-december-2026) ships on the 16.5.x line, and no 16.4 backport has been announced. We checked every claim below on 5 December 2026 against the Next.js blog, the GitHub release and its pull requests, the docs and the npm registry. We did not run 16.5 on a demo, so the build speed-ups are Vercel's numbers, not ours.

  - 16.5.0 is the only 16.5 release on npm on 5 December. The next patch, 16.5.x, is due on 15 December with ten security fixes.
  - Three defaults flipped: Turbopack GC, minify-before-chunking and durable `use cache` keys. Only the first two have a documented `false` switch.
  - `next build` with `NODE_ENV=development` now fails before compiling. That is the change most likely to break a CI or Docker build.
  - On Cloudflare, upgrade to `@opennextjs/cloudflare` 1.20.20 together with Next.js: with 1.20.19, every request returned a 500 error.

## What changed in Next.js 16.5

The [Next.js 16.5 post](https://nextjs.org/blog/next-16-5) lists the features. The [v16.5.0 release notes](https://github.com/vercel/next.js/releases/tag/v16.5.0) list every change by pull request, under Core, Example and Misc changes, with no breaking-change section. We read the full notes through GitHub's API and opened the pull requests behind every change that alters behaviour on upgrade. On the [npm registry](https://registry.npmjs.org/next), this is where the 16.x line stood on 5 December:

| Version | Released | dist-tag on 5 Dec | What it is |
| --- | --- | --- | --- |
| [16.4.5](https://github.com/vercel/next.js/releases/tag/v16.4.5) | 3 Nov 2026 | - | The November security release |
| [16.4.6](https://github.com/vercel/next.js/releases/tag/v16.4.6) | 9 Nov 2026 | - | Three backported fixes, the latest 16.4 |
| 16.5.0 | 2 Dec 2026 | `latest` | The minor release this post covers |
| 16.5.x | Due 15 Dec 2026 | - | Security release: 8 high, 1 medium, 1 low |
| 16.6.0-canary.4 | - | `canary` | Next minor, in canary |

16.5.0 also contains the seven fixes from [Next.js 16.4.5](https://www.outofplace.space/blog/nextjs-16-4-5-security-release) and the route handler compression from 16.4.6 (the release notes list them again), so upgrading loses no patch. The dependencies barely move. `sharp`, the optional image library, goes from `^0.35.5` to `^0.35.6`, and `@next/safe-image-optimization` 0.0.5 joins as a new dependency for the experimental safe mode. The React peer range and the Node.js range stay as they were in 16.4.6.

### What changes by default

These are the changes a team gets without touching its config, each with the pull request that made it:

| Change | 16.4.6 | 16.5.0 | To undo it |
| --- | --- | --- | --- |
| Turbopack garbage collection ([#101591](https://github.com/vercel/next.js/pull/101591)) | Off on stable releases | On in `next dev` and `next build` | `experimental.turbopackGc: false` |
| Minify before chunking ([#102520](https://github.com/vercel/next.js/pull/102520)) | Off on stable releases | On in production builds | `experimental.turbopackMinifyBeforeChunking: false` |
| Durable `use cache` keys ([#101922](https://github.com/vercel/next.js/pull/101922)) | Build ID in every key | Code, Next.js version and env values in the key (Turbopack production builds) | No switch in the docs |
| `next build` with `NODE_ENV=development` ([#102671](https://github.com/vercel/next.js/pull/102671)) | Failed while prerendering, or passed | Fails before compiling | Remove it, or set `experimental.allowDevelopmentBuild` |
| `experimental.lockDistDir` ([#100747](https://github.com/vercel/next.js/pull/100747)) | Could switch off the `.next` lockfile | Option removed | None: the lockfile always applies |
| Managed `AGENTS.md` instructions ([#101746](https://github.com/vercel/next.js/pull/101746)) | [Supported since 16.3](https://nextjs.org/docs/app/guides/ai-agents) | Created or refreshed on every `next dev`, without agent detection | `agentRules: false`, per the pull request |

With garbage collection, the Turbopack cache grows with the size of the app rather than with the number of edits, as the [16.5 post puts it](https://nextjs.org/blog/next-16-5#automatic-disk-cache-cleanup). Per the [turbopackGc reference](https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopackGc), it removes unreachable work from memory and the persistent cache, and by default drops a root after it has been unanchored for three days. Minify-before-chunking is the change you will see in your build output: Turbopack now sizes chunks by their minified code ([#101010](https://github.com/vercel/next.js/pull/101010)), so chunk boundaries and file names can differ from 16.4.6 for the same source. The `AGENTS.md` change concerns repos that use coding agents. Every `next dev` now writes a managed block pointing agents at the bundled docs. If you commit that file, expect a diff after the first run.

### How much faster is Turbopack in Next.js 16.5?

On Vercel's own dashboard, measured by Vercel on a 30-core, 60 GB build machine, cold compilation went from 183 s on 16.4.6 to 44 s on 16.5.0. A full cold production build went from 325 s to 159 s, and peak memory while compiling fell from 24.1 GB to 15.0 GB. Across five other Vercel apps, the post reports 6% to 27% less peak memory. These are the vendor's numbers on a very large app. Expect a smaller absolute gain on a small site, and time your own build before and after.

### Cross-deployment caching for use cache: remote

Until 16.4.6, every `use cache` key contained the build or deployment ID, so each deploy started every cached function cold. In 16.5, a Turbopack production build hashes the cached function's module, the modules it imports, the Next.js version and the values of the environment variables it reads, as the [use cache reference](https://nextjs.org/docs/app/api-reference/directives/use-cache#cache-keys) documents. That joins the arguments and closures that already made up [a use cache key](https://www.outofplace.space/blog/nextjs-use-cache#how-use-cache-works-what-makes-two-calls-share-an-entry). If none of that changes, the next deploy can read the entries the previous one wrote. Expiry and tags work as before.

That only matters when the entries outlive a deploy, which takes a durable cache handler. That is the usual case for `'use cache: remote'`, and the [use cache: remote reference](https://nextjs.org/docs/app/api-reference/directives/use-cache-remote#persistence-across-deploys) says the same applies to plain `use cache` with a durable handler. In-memory entries still die with the deployment. Next.js falls back to the build ID in two cases:

- **Dynamic `process.env` access.** If the cached function's module, or anything it imports, reads `process.env[key]` or passes `process.env` to a function, Next.js can't tell which variables matter and keeps the old per-deployment key ([#102094](https://github.com/vercel/next.js/pull/102094)). Read variables by name (`process.env.API_URL`) in cached code.
- **webpack builds.** The key always contains the build ID.

If `deploymentId` is set in `next.config`, it takes the build ID's place in those fallback keys.

### Features worth turning on now

- **`next build --analyze`**: worth it today if CI already runs `next analyze --output`. The report now comes from the production build itself, so it needs no second compilation and matches the deployed JavaScript, CSS and source maps ([#99962](https://github.com/vercel/next.js/pull/99962)).
- **`<Link prefetch="navigation">`**: only for apps that use `await navigation()` from 16.4 to keep parts of a page out of prefetches. On the one link a user is most likely to click next, it prefetches that deferred content as well. The pull request also adds `"shell"` and `"prefetch"`, aliases for no prop and `true` ([#99871](https://github.com/vercel/next.js/pull/99871)). How much a prefetch costs is in [our measurement of Partial Prefetching](https://www.outofplace.space/blog/nextjs-prefetch-benchmark).
- **`next upgrade --ci`**: sets up a daily GitHub Actions workflow in which Codex or Claude Code upgrades the app and opens a pull request, with a policy of security advisories only or every stable release. With 15 December coming, a security-only policy is the cheapest way to get the patch as a pull request on release day. The post runs it as `npx next@canary upgrade --ci`, and it needs an API key or a Claude subscription stored as a repository secret.
- **`experimental.requestInsights`**: development only. `next dev` keeps the last 500 requests, and DevTools shows how long compilation, module loading, data fetching and rendering took. It only runs in `next dev`, so it is safe to try.

### Experimental: Go Route Handlers and safe image mode

`experimental.goRoutes` lets a `route.go` file sit next to TypeScript routes. Turbopack compiles it into a native executable, and it needs Go 1.24 or later. The same flag enables [a Go proxy, `proxy.go`](https://github.com/vercel/next.js/pull/101464). [Self-hosting works with `output: 'standalone'`](https://github.com/vercel/next.js/pull/102362), while `output: 'export'` is rejected. Try it on a branch: it is experimental, and the Go proxy's hosted rollout on Vercel still depended on adapter changes when it merged.

`experimental.imgOptSafeMode` replaces `sharp` with memory-safe decoders, process isolation and Linux seccomp sandboxing ([#101254](https://github.com/vercel/next.js/pull/101254)). It is aimed at self-hosted apps that optimise images from sources they don't control. The post notes the option may be ignored where the platform runs its own optimiser, as on Vercel.

## Who is affected by the Next.js 16.5 changes

Every app on Turbopack gets the garbage collection and chunking defaults. The rest depends on your setup:

| Your setup | What 16.5 changes for you |
| --- | --- |
| `NODE_ENV=development` in a shell profile, Dockerfile or CI where `next build` runs | The build fails before compiling, with a message naming `NODE_ENV`. Some Pages Router builds that used to pass now fail too. |
| `experimental.lockDistDir: false` in `next.config` | The option is gone, and the lockfile on the `.next` directory can no longer be switched off. Its NFS bug is fixed ([#100684](https://github.com/vercel/next.js/pull/100684)). |
| `next build --no-lint` in a script | Still an error, as since Next.js 16.0, but now with migration guidance ([#102190](https://github.com/vercel/next.js/pull/102190)). Remove the flag. |
| Cache Components with a durable cache handler | Entries survive deploys when code and env values stay the same. The first 16.5 deploy starts cold, because the Next.js version is in the key. |
| `@opennextjs/cloudflare` 1.20.19 | Every request returned 500 on 16.5.0 ([issue #1530](https://github.com/opennextjs/opennextjs-cloudflare/issues/1530)). Fixed in [1.20.20](https://registry.npmjs.org/@opennextjs/cloudflare). |
| Bundle-size budgets or bundle diffs in CI | Expect different chunks for the same code after minify-before-chunking. Reset the baseline on 16.5. |
| `experimental.exposeTestingApiInProductionBuild` without `cacheComponents` | Now a config error rather than a silently disabled API ([#101952](https://github.com/vercel/next.js/pull/101952)). |

### How to tell which ones apply to you

From the project root:

```bash
npx next --version                                        # 16.4.x: this post applies
grep -rn "lockDistDir\|allowDevelopmentBuild" next.config.*
grep -rn "no-lint" package.json .github 2>/dev/null       # build scripts and CI
grep -rn "NODE_ENV=development" Dockerfile* .github 2>/dev/null
grep -rln "use cache" app src lib 2>/dev/null | xargs grep -ln "process.env\[" 2>/dev/null
npm ls @opennextjs/cloudflare                              # below 1.20.20: upgrade it too
```

The fifth line only finds `process.env[...]` in files that contain a cached function. A dynamic read in a module they import also forces the fallback, so check shared config helpers as well.

## How to upgrade from Next.js 16.4 to 16.5

**1. Check your adapter first.**
    On Cloudflare with OpenNext, plan to upgrade `@opennextjs/cloudflare` to 1.20.20 or later in the same change. Its peer range (`>=16.4.5`) already accepts 16.5, so npm won't warn you if the adapter is too old. On another platform, check that its Next.js integration lists 16.5.

**2. Clean the build environment and config.**
    Remove `NODE_ENV=development` from wherever `next build` runs, delete `experimental.lockDistDir` from `next.config`, and drop `--no-lint` from build scripts.

**3. Install Next.js 16.5.0.**
    Run `npm install next@16.5.0` (`pnpm add` and `yarn add` work the same), then `npm ls next` to confirm what the lockfile resolved. `react` and `react-dom` can stay where they are. The blog's `npx next@canary upgrade --agent=latest` hands the same job to a coding agent.

**4. Build once and reset your baselines.**
    Run `next build --analyze` and keep the report as the new baseline for bundle budgets, because chunking changed. Compare the build time with your last 16.4.6 build. If the dev server or CI disk misbehaves after the upgrade, `experimental.turbopackGc: false` and `experimental.turbopackMinifyBeforeChunking: false` are the two switches to try.

**5. Recheck what your cache relied on.**
    If a deploy used to flush stale cache entries for you, after a CMS schema change or a data migration for example, it no longer does when the code and env values stay the same. Invalidate with `revalidateTag` or `updateTag` instead. In cached code, read environment variables by name, so entries can be reused across deploys.

**6. Be ready for 15 December.**
    The security patch lands as a 16.5.x patch release. Once you are on 16.5.0, it is a one-line version bump. To get it as a pull request on the day, set up `next upgrade --ci` with the security-only policy now.

## What to watch out for

- **No breaking-change list.** The v16.5.0 release notes have no breaking-changes section. The `NODE_ENV` change is called breaking only in its own pull request ([#101978](https://github.com/vercel/next.js/pull/101978)), which asks for it to be mentioned in the changelog. Go by the table above, not by the release page.
- **pnpm 12 is not a requirement.** The release notes mention an "Upgrade from pnpm v10 to v12" ([#99827](https://github.com/vercel/next.js/pull/99827)). That is the Next.js repository's own tooling, not something your project has to install.
- **`--no-lint` was not removed in 16.5.** It stopped working in Next.js 16.0. 16.5 only replaces the bare "unknown option" error with a message that says what to do.
- **No switch for durable keys in the docs.** On 5 December, neither `use cache` reference documented a way to turn cross-deployment keys off. What you control is what goes into the key: code, env values read by name, `deploymentId`.
- **Security details are not public yet.** The notice of 1 December gives counts and severities only, with no CVEs or affected versions until 15 December. It names the 16.5.x line and says nothing about 16.4 or 15.x.
- **When we read each source.** The Next.js 16.5 post, the December security notice, the v16.5.0 and v16.4.6 releases, the pull requests linked above, the `use cache`, `use cache: remote` and `turbopackGc` docs, the npm registry for `next` and `@opennextjs/cloudflare`, and OpenNext issue #1530, all on 5 December 2026. We did not build or run 16.5.0 ourselves.

## Further reading

- [Next.js 16.5](https://nextjs.org/blog/next-16-5): The release post of 2 December 2026: features, Vercel's build benchmarks and the upgrade commands.

- [Next.js v16.5.0 release](https://github.com/vercel/next.js/releases/tag/v16.5.0): The full changelog with every pull request, including the defaults and removals in the table above.

- [Upcoming Next.js December Security Release](https://nextjs.org/blog/upcoming-nextjs-security-release-december-2026): The notice of 1 December 2026: ten issues, fixed on the 16.5.x line on 15 December.

- [use cache: remote](https://nextjs.org/docs/app/api-reference/directives/use-cache-remote): How entries persist across deploys, and when Next.js falls back to the build ID.

- [next on the npm registry](https://registry.npmjs.org/next): Every version with its publish time, dependencies and dist-tags.

- [OpenNext Cloudflare issue #1530](https://github.com/opennextjs/opennextjs-cloudflare/issues/1530): The 500 error on every request with Next.js 16.5.0, closed by the 1.20.20 release.

- [Next.js use cache: cache keys, lifetime and updateTag](https://www.outofplace.space/blog/nextjs-use-cache): How Next.js use cache works, in a live demo: the arguments make the cache key, cacheLife sets how long an entry lives, and updateTag clears one tag's entries.
