Upgrading to Next.js 15 in 5 Mins using Codemod

Hey everyone! I’m thrilled to share my experience upgrading a small Next.js project from Next.js 14 to the freshly-released Next.js 15. The official codemod tool (ie npx @next/codemod@canary upgrade) promises to streamline this process, and I couldn’t wait to put it to the test.

If you’re intrigued, I’ve also documented the entire upgrade process in the YouTube video below which you can check out for a visual walkthrough:

Key Features of Next.js 15

Before diving into the upgrade, let's quickly touch on some of the fantastic new features that come with Next.js 15, as detailed in my blog post:

  • Support for React 19: Leveraging the latest improvements in React, while retaining backward compatibility with React 18.

  • Enhanced CLI and Codemods: The npx @next/codemod@canary upgrade command facilitates smoother and faster upgrades.

  • Turbopack Dev (Stable): Significantly faster development experience with up to 96.3% faster code updates.

  • Static Route Indicator: Visual distinction between static and dynamic routes for enhanced development clarity.

  • Enhanced Forms (next/form): Expanded capabilities with features like prefetching and client-side navigation.

  • Executing Code After Response: The new unstable_after API for post-response tasks like logging and analytics.

  • New Observability APIs (instrumentation.js): Deep insights into application performance with integrations to popular observability tools.

  • Improved TypeScript Support: Enhanced TypeScript support including next.config.ts files.

The Upgrade Process

Upgraded coporate blog template in 5 min

Here’s a step-by-step recount of how I upgraded my small-scale project—a corporate blog demo—from Next.js 14 to 15:

  1. Initial Setup:

    • I fired up the project, which you can see in the video, running perfectly on Next.js 14.

  2. Running the Codemod Tool:

    • Enabled Turbo Pack to optimize the build process.

    • Installed the React 19 Code Mod.

    • Accepted all necessary type upgrades.

    The goal was to see how efficiently and quickly this codegen tool could handle the upgrade.

  3. Observing the Transformation:

    • The codegen tool seamlessly transformed synchronous functions into asynchronous ones.

    • Applied essential updates to the TSConfig.

    • Handled search parameters with a new async-await pattern.

  4. Testing and Debugging:

    • Ran npm start to see the changes in action.

    • Faced a minor issue with a .ICO file format which was easily corrected by renaming it to favicon.png.

    The Turbo Pack really shone here—instead of the previous sluggish load times, pages loaded almost instantaneously!

  5. Final Steps:

    • Verified that all pages were functioning flawlessly in the development environment.

    • Committed the changes with a concise message, signifying the successful upgrade.

Video Walkthrough

For those who prefer a visual guide, watch my YouTube video showcasing the entire upgrade process for Wisp's Next.js Corporate Blog Template from start to finish. You'll see just how swift and straightforward this transition can be, even for smaller projects.

What's Next?

This smooth upgrade with the help of the codegen tool has been incredibly enlightening. The benefits of Next.js 15, especially the speed improvements with Turbo Pack, are noteworthy and promising.

Raymond Yeh

Raymond Yeh

Published on 22 October 2024

Get engineers' time back from marketing!

Don't let managing a blog on your site get in the way of your core product.

Wisp empowers your marketing team to create and manage content on your website without consuming more engineering hours.

Get started in few lines of codes.

Choosing a CMS
Related Posts
My Experience Navigating the Next.js 15 Upgrade

My Experience Navigating the Next.js 15 Upgrade

Next.js 15 was released today and I've tried upgrading my project from Next.js 14. Codegen helped to fix 80-90% of the issues but there were issues due to upgrade from React 18 to 19!

Read Full Story
Next.js 15 is out! What's new and what broke?

Next.js 15 is out! What's new and what broke?

Next.js 15: A Must-Read for Web Developers! Learn about the latest updates, new observability APIs, and improved TypeScript support. Equip yourself with the knowledge to upgrade effortlessly!

Read Full Story
Static Site, Dynamic Content: Powering Your NextJS Static Site with Lightweight Blog-Only CMS

Static Site, Dynamic Content: Powering Your NextJS Static Site with Lightweight Blog-Only CMS

Tired of choosing between static site performance and dynamic content? Learn how to integrate Wisp CMS with NextJS for the ultimate blogging solution. Best of both worlds awaits!

Read Full Story