Next Upgrade

作者 vercel882e66c26986無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Upgrade Next.js to the latest version following official migration guides and codemods. Use when upgrading Next.js versions, running codemods, or migrating between major releases.

AI 產生的概覽

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

功能
逐步完成 Next.js 版本升級:從 package.json 偵測目前版本、取得官方升級指南、規劃增量遷移路徑、執行 Next.js codemod、更新 Next.js 與同層相依套件,並檢視破壞性變更。也涵蓋更新 TypeScript 型別,以及透過建置與開發執行來驗證結果。產出是升級後的專案,以及關於手動修改的指引。
適用情境
適用於將 Next.js 專案升級到較新或最新版本、執行 Next.js codemod,或在主要版本之間遷移(例如 13 到 14 到 15)。也適用於在此類升級中處理破壞性變更或設定更新。
執行需求
需要既有的 Next.js 專案(含 package.json)與 Node.js 工具鏈(npm、pnpm、yarn 或 bun)。需要網路存取以取得官方升級文件並安裝套件與 codemod。此技能未附帶指令碼,僅為操作說明。

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/vercel-plugin位於skills/next-upgrade提交882e66c

授權條款: 無授權條款

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

檢舉或申請下架