Next.js 16.5 is out, and its headline change is speed. In Vercel’s benchmarks, cold compilation with Turbopack is about 4.2 times faster, memory use drops 38 percent and the on-disk cache is 14 percent smaller. The release also lets remote caches survive redeploys.
Developers can upgrade with npm install next@latest, or hand the job to a coding agent with npx next@canary upgrade –agent=latest.
What’s new in Next.js 16.5
- Faster Turbopack builds with lower memory and disk use
- Cross-deployment caching for functions marked use cache: remote
- A per-link prefetch=”navigation” setting
- An upgrade –ci command that sets up automated upgrades on GitHub Actions
- An experimental safe mode for image optimization
- Experimental native Route Handlers, starting with Go
Turbopack gets much faster
Vercel says the work responds to how people build now. One developer may run a fleet of agents that start dozens of Next.js servers on a single machine, so build tools face heavier loads than before. The team focused on three areas: using all available CPU cores during builds, scaling apps to thousands of routes, and trimming memory and disk overhead so apps fit inside build container limits.
The benchmark compiled Vercel’s dashboard on a 30-core, 60 GB machine. Cold-start compile times in 16.5 were four times as fast as in 16.4.6. That helps agents in particular, because they tend to work from a fresh checkout. Full production builds on a cold start take about half the time.
Across five other Vercel apps, including nextjs.org, peak memory fell 6 to 27 percent and disk caches shrank by up to 23 percent.
Next.js 16.4 shipped an experimental garbage collector for Turbopack, controlled by the turbopackGc flag. In 16.5 it’s on by default. The cache now grows with the size of the application instead of the number of edits, which keeps rebuilds quick in long dev sessions.
Remote caches carry across deployments
Until now, deploying a new version reset the cache for every function using use cache: remote. Next.js put the build or deployment ID in each cache key to avoid stale data. Take a getProduct function that queries a database: even if you only edited an unrelated page, the first call after redeploying hit the database again.
Version 16.5 changes that. Turbopack scans cached functions and their dependencies and builds each cache key from the function, the code it depends on and the environment values it reads. If none of those changed, the new deployment reuses entries from the previous one.
Entries still expire and revalidate as usual. Next.js stops reusing an entry if any transitive import or environment value changes. When Turbopack can’t work out everything a function depends on, it falls back to a deployment-specific key, which happens in particular with dynamic access such as process.env[variable].
Bundle analysis in a normal build
A new –analyze option on next build writes a report to .next/diagnostics/analyze during your regular production build. That avoids a second compile and makes sure the JavaScript, CSS and source maps in the report match what ships. It can run in CI so bundle changes are tracked over time.
Smarter prefetching
Next.js 16.4 added the navigation() API, which excludes content from a prefetch so secondary parts, such as an email’s reply thread, don’t render until someone actually navigates. In 16.5, setting prefetch=”navigation” on an individual Link lets that link prefetch cached content that navigation() would otherwise defer until click.
Automated upgrades, safer images and Go
Running next upgrade –ci sets up a GitHub Actions workflow in which a coding agent upgrades your app and opens a pull request whenever a new release ships.
The experimental image safe mode uses sandboxing and memory-safe image decoders to reduce the risks of processing untrusted images. And Next.js 16.5 introduces experimental native Route Handler support, beginning with Go, so a route.go file can sit next to your TypeScript routes.
What to try first
Teams with slow CI should measure a cold build before and after upgrading, since that’s where the largest gain was reported. Apps with expensive remote-cached queries are the next candidates, because redeploys no longer wipe their entries. The Go handlers and image safe mode are experimental, so test them outside production first.
Source: nextjs.org