Next Upgrade

作者 vercel-labs672deb21e70e無授權條款1.6K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Upgrade Next.js to the latest version following official migration guides and codemods

精選僅含說明Software Development
AI 產生的概覽

依據官方遷移指南與 codemod,指導將 Next.js 專案升級到最新版本。

功能
引導代理升級 Next.js 專案:從 package.json 辨識目前版本、取得官方升級指南、判斷逐步升級路徑、執行 Next.js codemod、更新 Next.js 與同層相依套件、檢視破壞性變更、更新 TypeScript 型別並測試建置。產出升級後的專案,以及一連串遷移步驟與指令。
適用情境
當 Next.js 應用程式需要升級到較新的主版本或次版本,且希望依循官方指南與 codemod 進行遷移時使用。也適合規劃逐步版本跳升,並在升級前檢視破壞性變更。
執行需求
需要網路存取以取得 Next.js 升級文件,需要具備 npm 與 npx 的 Node.js 專案,以及專案的 package.json。此技能未附帶指令碼,僅為說明性指示。

Upgrade Next.js

Upgrade the current project to the latest Next.js version following official migration guides.

Instructions

  1. Detect current version: Read package.json to identify the current Next.js version and related dependencies (React, React DOM, etc.)

  2. Fetch the latest upgrade guide: Use WebFetch to get the official upgrade documentation:

  3. Determine upgrade path: Based on current version, identify which migration steps apply. For major version jumps, upgrade incrementally (e.g., 13 → 14 → 15).

  4. Run codemods first: Next.js provides codemods to automate breaking changes:

    bash
    npx @next/codemod@latest <transform> <path>

    Common transforms:

    • next-async-request-api - Updates async Request APIs (v15)
    • next-request-geo-ip - Migrates geo/ip properties (v15)
    • next-dynamic-access-named-export - Transforms dynamic imports (v15)
  5. Update dependencies: Upgrade Next.js and peer dependencies together:

    bash
    npm install next@latest react@latest react-dom@latest
  6. Review breaking changes: Check the upgrade guide for manual changes needed:

    • API changes (e.g., async params in v15)
    • Configuration changes in next.config.js
    • Deprecated features being removed
  7. Update TypeScript types (if applicable):

    bash
    npm install @types/react@latest @types/react-dom@latest
  8. Test the upgrade:

    • Run npm run build to check for build errors
    • Run npm run dev and test key functionality

來源與署名

來源:vercel-labs/openreview位於.agents/skills/next-upgrade提交672deb2

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架