Next JS Changelog: What's New in Next.js 15 and Beyond

Author

Reads 307

Black Screen With Code
Credit: pexels.com, Black Screen With Code

Next.js 15 has brought some exciting changes to the table. Improved performance is one of them.

Next.js 15 has reduced the bundle size by up to 50% by default, making it faster to load and more efficient overall.

With the new "automatic static optimization" feature, Next.js 15 can automatically optimize static pages, making it easier to get started with serverless architectures.

This feature is especially useful for developers who are new to serverless architectures, as it eliminates the need for manual configuration.

Next.js 15 Updates

Next.js 15 has been updated to v15.0.4-canary.20, which includes several key fixes and features.

The update fixes sourcemaps for internal client boundaries, ensuring that developers can more easily debug their applications.

Turbopack has received several updates, including thread tracing through to resolve results and tracing manifests and externals.

Here are some of the key Turbopack updates:

  • Fix effects tracing: #72928
  • Turbopack: trace manifests and externals: #72316
  • Turbopack: NFT followups: #72517

Documentation updates include fixing code block language in redirecting docs and adding section titles to error pages.

Credit: youtube.com, Next.js 15 Top 8 Changes - Everything is changing again?

Here are some of the key documentation updates:

  • docs: fix code block language in redirecting docs: #72944
  • docs: add the section titles to error page: #72942
  • docs: update "Migrate to async Dynamic APIs" docs: #72852

Other updates include fixing a broken link to the rootDir doc and simplifying VAPID key generation docs.

The update also includes a new feature: Implement module walking for side effect optimization.

Next.js 14 and Earlier

Next.js 13 introduced a new file system routing system, which allows for more flexible and maintainable routing configurations.

This change is a significant improvement over the previous version, which relied on a complex system of nested routes.

In Next.js 12, the team introduced a new API route feature, which enables developers to create server-side rendered pages with API routes.

This feature is particularly useful for building robust and scalable server-side rendered applications.

Next.js 11 introduced a new built-in support for internationalized routing, making it easier for developers to create multilingual applications.

This feature is a significant improvement over the previous version, which required additional setup and configuration.

Next.js 14.2

Next.js 14.2 brought some exciting updates to the table. One of the notable changes was the addition of improved support for server-side rendering (SSR) and static site generation (SSG).

Credit: youtube.com, What's New in NextJs 14.2

This release also included enhancements to Next.js's internationalization (i18n) features, making it easier to support multiple languages in your application.

Next.js 14.2 also introduced better error handling and debugging tools, which can be a huge time-saver when something goes wrong.

The improved error handling features allow you to catch and display errors in a more user-friendly way, making it easier to identify and fix issues.

Next.js 14

Next.js 14 is a significant update that brings many exciting features to the table. It's built on top of React 18, which means you get all the benefits of the latest React version.

One of the key features of Next.js 14 is its improved support for Server Components. With this new feature, you can render components on the server, which can lead to faster page loads and improved SEO.

Next.js 14 also introduces a new feature called Image Optimization, which automatically optimizes images for web use. This can help reduce page load times and improve user experience.

Credit: youtube.com, the most important Next.js features to learn (in 8 minutes)

Another notable feature of Next.js 14 is its improved support for internationalization. With this feature, you can easily create multilingual websites and applications.

Next.js 14 also includes a new feature called App Directory, which allows you to create custom app directories for your Next.js applications. This can be useful for organizing complex applications.

With Next.js 14, you can now use React 18's Concurrent Mode, which can improve the performance of your applications. This feature is particularly useful for applications with complex layouts.

Adapter Packages

With Next.js 14 and earlier, you'll want to focus on setting up your adapter packages correctly. Beginning with Next-auth v5, you should install database adapters from the @auth/*-adapter scope instead of @next-auth/*-adapter.

Database adapters don't rely on any Next.js features, making it more sensible to move them to this new scope. This change is intended to improve organization and clarity in your project setup.

To get started, check out the official adapters page or the "create a database adapter" guide to learn how to create your own adapter.

Here's a step to create an auth.config.ts file:

  1. Create an auth.config.ts file which exports an object containing your Auth.js configuration options.
  2. This configuration object only contains common settings that don't rely on the adapter.
  3. Notice that you're not calling NextAuth() here, just exporting a configuration object.

Authentication

Credit: youtube.com, Next.js App Router Authentication (Sessions, Cookies, JWTs)

Authentication in Next.js has been simplified with the introduction of a single auth() function call, making it easier to authenticate server-side.

In the past, there were different ways to authenticate server-side, but now Next.js components are server-first by default, and standard Web APIs have been used to simplify the process.

You can use the auth() function call in most cases, replacing previous methods such as getServerSession(authOptions) and withAuth(middleware, subset of authOptions) wrapper.

The new auth() method supports various environments and contexts, including Server Component, Middleware, Client Component, Route Handler, API Route (Edge), API Route (Node.js), and getServerSideProps.

Here's a summary of the changes:

The auth() function is a universal method that can be used anywhere, replacing previous methods such as getServerSession, getSession, withAuth, getToken, and useSession.

TypeScript and Configuration

The NextAuth configuration file is now located in the root of the repository, and its name is recommended to be short for easy importing. This file exports functions that can be used across your application.

Credit: youtube.com, Next.js 15 Breakdown (Everything You Need To Know)

The configuration object passed to the NextAuth() function remains the same as before. However, the returned methods exported from the NextAuth() function call are new and required elsewhere in your application.

Here are the key changes to keep in mind:

  • The configuration file is now named auth.ts in the root of the repository.
  • You no longer need to install @auth/core to import provider definitions.
  • The configuration object passed to NextAuth() remains the same.
  • New methods are exported from the NextAuth() function call.

Configuration File

In the new configuration file, we've moved away from exporting configuration from one file and passing it around as authOptions throughout our application. This file is now located in the root of the repository and is named auth.ts.

The configuration file should look similar to your previous route-based Auth.js configuration, except that it's now exporting methods to be used elsewhere. It's a good idea to keep the file name short, as we'll be importing the exported methods from here across our app.

Some key things to note about the new configuration:

  • The configuration file is now in the root of the repository.
  • No need to install @auth/core to import provider definitions, as they come from next-auth itself.
  • The configuration object passed to the NextAuth() function is the same as before.
  • The returned methods exported from the NextAuth() function call are new and will be required elsewhere in your application.

The old configuration file, which was contained in the API Route, now becomes much shorter. These exports are designed to be used in an App Router API Route, but the rest of your app can stay in the Pages Router if you're gradually migrating.

TypeScript

Credit: youtube.com, TypeScript: tsconfig demystified!

In TypeScript, it's essential to be aware of the changes in configuration options. Specifically, NextAuthOptions has been renamed to NextAuthConfig.

NextAuthConfig is the new name for what was previously known as NextAuthOptions. This change is important to remember when working with NextAuth in your TypeScript projects.

The following types are now exported from all framework packages like next-auth and @auth/sveltekit. This means you can access these types directly from these packages, making your code more concise and easier to maintain.

Here's a list of the types that are now exported:

  • NextAuthConfig

By understanding these changes, you can write more efficient and effective TypeScript code for your NextAuth configurations.

Melba Kovacek

Writer

Melba Kovacek is a seasoned writer with a passion for shedding light on the complexities of modern technology. Her writing career spans a diverse range of topics, with a focus on exploring the intricacies of cloud services and their impact on users. With a keen eye for detail and a knack for simplifying complex concepts, Melba has established herself as a trusted voice in the tech journalism community.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.