Upgrade a Next.js project to v16 with guided codemods
Когда использовать: You've been putting off the Next 16 upgrade. You want an agent to drive codemods and fix async API migrations.
Предварительные требования
- Next.js project on v14+ — Check package.json
- Clean git working tree —
git statusshows clean — so you can revert if needed
Поток
-
Run the upgrade toolRun upgrade_nextjs_16 on this project. Walk me through each codemod before applying.✓ Скопировано→ List of planned changes with diffs to preview
-
Fix async API call sitesAfter codemods, build the project. For any errors from now-async cookies()/headers(), fix the call sites to use await.✓ Скопировано→ Build passes
-
Enable Cache ComponentsRun enable_cache_components. Fix any boundary errors it reports.✓ Скопировано→ Cache components enabled, app runs
Итог: A working Next 16 project with Cache Components, in one focused session instead of a scattered week.
Подводные камни
- Codemods can't fix custom-patterned async usage — Run the build after each codemod step; fix manually when the codemod tags 'REVIEW' comments
- Third-party libs may not be ready for Next 16 — Check package compatibility before upgrading; pin any lib that breaks and file an issue upstream