Next.js continues to evolve, offering a faster and more efficient environment for building web applications.
Next.js 15
, released in 2024, introduced several significant changes, so prepare carefully before upgrading an existing project.
This guide walks through upgrading from Next.js 14 to 15 with examples. If you're on an earlier version, consider upgrading to 14 first.
2. Review the next/font fallback Configuration ๐
The previous configuration in this example sets fallback fonts as follows.
const inter = Inter({ subsets: ['latin'], fallback: ['Arial'] });
The original guide describes a change to how fallback handles string arrays and notes that you may see a warning. If you do, check the font configuration documentation for your installed version.
. These affect access to request data in server-side code, including request.cookies and request.headers in the examples below.
The original synchronous approach uses a helper such as headers().
This pattern illustrates how to access properties such as cookies, headers, url, and body. Treat this example as experimental, and consult the official Async Request API codemod documentationโ before migrating your project.
for repetitive and error-prone changes. Common tasks include:
Removing or updating deprecated props, such as priority where applicable.
Refactoring code to use new APIs.
Updating calls affected by Async Request APIs.
Here's how to run a codemod.
npx @next/codemod <transform> <path>
The original example for removing priority is shown below.
npx @next/codemod remove-priority-image ./src
Check the available codemods in the official documentationโ. Commit or back up your code in a version control system such as Git before applying a transform.
Upgrading to Next.js 15 takes care, but working through the changes one at a time makes the migration manageable. Review the release notes closely when dealing with deprecated props or configuration.
If you see unexpected build or runtime errors, start by identifying which features changed from the previous release.