Easy Upgrades with @next/codemod CLI
Next.js 15 introduces a CLI to streamline upgrading:
npx @next/codemod@canary upgrade latest
npm install next@latest react@rc react-dom@rc
It handles most of the breaking changes automatically, making the transition smoother.
Async Request APIs (Breaking Changes)
APIs like cookies()
, headers()
, params
, and searchParams
are now async. Codemods can help convert them, but warnings remain until the next major version.
Caching Semantics Overhaul
Defaults for caching have changed significantly:
- GET Route Handlers and Client Router Cache now default to
no-store
.
- Cached behavior can be restored via config, like:
export const dynamic = 'force-static';
Full React 19 Support
Next.js 15 now supports React 19 RC for App Router while keeping React 18 for Pages Router. It also enhances hydration debugging and introduces a new compiler (experimental).
Turbopack Goes Stable
The new dev server using Turbopack is now stable, giving performance boosts:
- ~77% faster startup
- ~96% faster Fast Refresh
- ~46% faster route compilation
Static Route Indicator
You can now visually distinguish static vs dynamic routes in the console during development.
Experimental unstable_after
API
Allows deferring tasks like logging after response streams. To enable:
experimental.after = true
Use it in server-side code:
import { unstable_after as after } from 'next/server';
after(() => logAnalytics());
Migration Path
Follow these steps to upgrade:
1. Upgrade CLI
npx @next/codemod@canary upgrade latest
2. Run Async Codemod
npx @next/codemod@canary next-async-request-api .
3. Enable Features
- Add experimental.after if needed
- Update config to .ts
- Tweak caching settings if preserving old behavior
4. Test Thoroughly
- Especially routing logic and caching
- Watch out for unstable_after and instrumentation
5. Adopt Turbopack
- Start with
next dev --turbo
- For production, test
next build --turbopack