Next.js (18. Upgrading) 정리
Next.js (18. Upgrading) 정리
0. 업그레이드
Next.js는 upgrade 명령어 또는 수동 설치로 버전을 업그레이드한다.
1. 최신 버전으로 업그레이드
1-1. upgrade 명령어 사용
Next.js 16.1.0 이상에서는 next upgrade 명령어로 최신 버전으로 업그레이드한다.
1
pnpm next upgrade
Next.js 16.1.0 미만 버전은 upgrade 명령어를 지원하지 않으므로 별도 패키지를 사용한다.
1
npx @next/codemod@canary upgrade latest
1-2. 수동 업그레이드
명령어 대신 직접 최신 Next.js와 React 패키지를 설치해 업그레이드할 수 있다.
1
pnpm i next@latest react@latest react-dom@latest eslint-config-next@latest
2. Canary 버전
2-1. Canary로 업그레이드
Canary는 정식 릴리스 전 최신 기능을 미리 사용할 수 있는 버전이다. 현재 최신 버전에서 정상 동작을 확인한 후 canary로 업그레이드한다.
1
pnpm add next@canary
2-2. Canary 전용 기능
현재 Canary에서 사용 가능한 주요 기능은 인증 관련 API다.
forbidden/forbidden.js— 접근 금지(403) 처리unauthorized/unauthorized.js— 인증 필요(401) 처리authInterrupts— 인증 인터럽트 설정
This post is licensed under CC BY 4.0 by the author.
