Next.js 15 RC

Next.js 15 RC (Release Candidate)

Next.js 15 Release Candidate is creating waves in the world of web development, but not everyone’s ready to ride them.

The inertia that some developers experience in the face of new updates and technologies often causes them to miss out on game-changing features.

The world of web development is always on the move, and the latest buzz comes from Vercel with the release of the Next.js 15 Release Candidate (RC). This new version is packed with updates and experimental features that aim to enhance the developer experience and streamline the process of building applications.

Let’s dive into what’s new, what’s changed, and how you can start experimenting with Next.js 15.

south americans finest developers

Introduction to Next.js 15 RC

Next.js continues to evolve, bringing more functionality and improved performance to your web development projects. The Release Candidate introduces several new features and updates that developers can start testing before the final release. This version supports React 19 RC, and it comes with a variety of experimental options to optimize your applications.

What’s New in Next.js 15

React 19 Support

The biggest headline of Next.js 15 is its support for React 19 RC. This includes compatibility with the latest React features and improvements such as the new React Compiler, which is still experimental. This compiler aims to optimize your React applications by automatically handling tasks like memoization, which previously required manual intervention.

What is the React Compiler?

The React Compiler is a new tool that helps in transforming React code to be more efficient. It reduces the need for manual optimizations like useMemo and useCallback by understanding your code deeply and applying changes automatically where it can be more effective. This means less code for you to manage and potentially faster component rendering.

Code Sample: Using React Compiler

// Add this to your next.config.js to enable React Compiler
module.exports = {
experimental: {
reactCompiler: true,

Enhanced Caching Mechanisms

Next.js 15 introduces significant changes to how caching is handled. By default, fetch requests, GET Route Handlers, and client navigations are no longer cached. This change addresses the community feedback requesting more control over caching behaviors.

Code Sample: Disabling Default Cache

// Example of fetching data with no-store option to bypass cache
fetch('', { cache: 'no-store' });

Partial Prerendering

This version also rolls out an experimental feature for partial prerendering. It allows developers to incrementally adopt static generation for individual pages or components, making it easier to optimize performance without a full overhaul of your application.

What is Partial Prerendering?

Partial Prerendering allows you to prerender only specific parts of your page, leaving other parts to be rendered client-side or server-side as needed. This approach is beneficial for improving the performance of your application, as it reduces the initial load time by serving a static HTML shell first and then hydrating the page with dynamic content.

Code Sample: Implementing Partial Prerendering

// Mark a page for partial prerendering in Next.js
export const config = {
unstable_runtimeJS: false

New API: next/after

Another experimental feature, next/after, lets you execute code after a response has finished streaming. This is useful for operations that need to happen post-response, like logging or analytics, without delaying the response time.

How next/after Enhances Server Responses

Using next/after, developers can schedule tasks like logging, analytics, or data synchronization to execute after the main response has been delivered. This feature is particularly useful in serverless environments where it’s important to minimize response times.

Code Sample: Using next/after

import { unstable_after as after } from 'next/server';

export function middleware(request) {
after(() => {
console.log('Response sent.');
return new Response('Hello, world!');

Updates to create-next-app

The create-next-app utility has been updated with a cleaner design and new flags that make setting up a Next.js project smoother. One notable addition is the option to enable Turbopack during local development, promising faster build times.

What’s New in create-next-app

The updated create-next-app includes a simpler, more intuitive interface and options to include or exclude features like TypeScript or Tailwind CSS at the project initialization stage.

Code Sample: Creating a Next.js App with Turbopack

npx create-next-app@rc --turbo

Enhanced API Routes in Next.js 15

In the latest Release Candidate, Next.js 15 has made some significant improvements to API routes, which are used to handle server-side logic directly within the Next.js framework. These routes now offer more flexibility and better performance, making server-side operations more efficient.

New Features in API Routes

One of the major enhancements in API number 15 is the introduction of more granified control over caching and configuration of API routes. This includes detailed options for handling HTTP methods more intuitively and efficiently.

Example: Configuring API Routes with Improved Caching

Let’s look at how you can leverage the new caching capabilities in your API routes:

// pages/api/data.js
export const config = {
api: {
bodyParser: false,
cache: 'no-store'

export default function handler(req, res) {
res.status(200).json({ message: 'This is uncached data!' });

In this example, the cache: 'no-store' setting ensures that responses from this API route are not cached, ensuring that clients always receive the most current data available.

More Robust Image Optimization

Next.js 15 also introduces enhancements to its built-in image optimization capabilities. The framework’s next/image component is a powerful tool for automatically resizing and optimizing images on the fly, and it now supports additional options and formats.

Enhanced Support for Modern Image Formats

With the growing importance of performance in web applications, efficiently handling images is crucial. Next.js 15 expands support for modern image formats like AVIF, providing better compression rates and faster loading times without sacrificing quality.

Example: Using next/image with AVIF

Here’s how you can use the next/image component to automatically serve AVIF images when supported by the browser:

import Image from 'next/image';

export default function MyComponent() {
return (
alt="Descriptive alt text"
formats={['avif', 'webp', 'jpeg']}

In this code snippet, the formats prop is used to specify which image formats to use, prioritizing AVF if the client supports it, followed by WebP and JPEG as fallbacks.

Improved Internationalization (i18n) Support

Another area where Next.js 15 shines is in its improved support for internationalization. The framework makes it easier to manage localized routing and language detection, simplifying the process of creating multi-lingual websites.

Streamlined Localization Handling

The configuration for internationalization has been streamlined, allowing for automatic language detection and seamless redirection based on user preferences or geographic location.

Example: Configuring i18n in next.config.js
// next.config.js
module.exports = {
i18n: {
locales: ['en-US', 'fr-CA', 'es-MX'],
defaultLocale: 'en-US',
domainSpecificLocales: [
{ domain: '', defaultLocale: 'fr-CA' },
{ domain: '', defaultLocale: 'es-MX' }

This configuration sets up three locales and assigns them to specific domains, enabling a tailored user experience based on the domain accessed.

Middleware Enhancements

Next.js 15 introduces several updates to middleware, making it more powerful and easier to use. Middleware in Next.js allows developers to run code before a request is completed, offering a great place to implement features like authentication, redirects, and more.

Example: Using Middleware for Redirects

Here’s a simple example of how middleware can be used to handle redirects based on specific conditions:

// middleware.js
import { NextResponse } from 'next/server';

export function middleware(request) {
const { pathname } = request.nextUrl;

// Redirect to the new about page
if (pathname === '/old-about') {
return NextResponse.redirect('/new-about');


This middleware checks if the user is visiting an old URL and redirects them to a new location, improving the user experience and maintaining link integrity.

Router Enhancements

The routing capabilities of Next.js have been extended in version 15, providing more granular control over route handling and optimizations that reduce load times even further.

Dynamic Routing Improvements

Dynamic routing is now more efficient, with better support for wildcards and optional catch-all routes. These improvements make it easier to create complex routing patterns without compromising performance.

Example: Using Optional Catch-All Routes
// pages/posts/[[...slug]].js
export default function Post({ slug }) {
return <div>Post Slug: {slug.join('/')}</div>;

This page will match any route like /posts/1/2/3, and the slug array will contain the path segments. This is particularly useful for building applications that require flexible URL schemas.

Optimization of Bundling External Packages

Bundling strategies have also been enhanced in Next.js 15. There’s a new focus on optimizing the bundling of external packages, which can significantly improve the cold start performance of applications, especially those deployed on serverless platforms.

Improved External Package Handling

Developers can now more easily include or exclude specific packages from being bundled, which is crucial for controlling the size and performance of your application bundles.

Example: Configuring External Packages in next.config.js
// next.config.js
module.exports = {
experimental: {
esmExternals: true, // Enable externalizing of ESM packages
externalDir: true, // Include all directories in the external packages check

These configurations help manage how external packages are treated during the build process, enabling more efficient bundling and faster startup times.

Additional Client-Side Enhancements

Next.js 15 RC also brings several client-side enhancements, including improved handling of environment variables and updates to built-in components like next/link and next/image for better usability and performance.

Streamlined Environment Variable Access

Access to environment variables is now more streamlined, making it easier for developers to manage and access environment settings securely and efficiently.

Example: Using Environment Variables in Next.js
// Displaying an environment variable in a component
export default function ShowEnv() {
return <div>API URL: {process.env.NEXT_PUBLIC_API_URL}</div>;

In this example, NEXT_PUBLIC_API_URL is an environment variable that can be accessed directly in any component, simplifying configuration and deployment workflows.

Getting Started with Next.js 15 RC

To start experimenting with Next.js 15 RC, you can update your project’s package.json to include the latest versions of next, react, and react-dom.

npm install next@rc react@rc react-dom@rc

This setup will allow you to test out all the new features and provide feedback to the Next.js team before the final release.

Community Feedback on Next.js 15 RC

The community response has been largely positive, with developers excited about several key features such as the improved React 19 support and the React Compiler. However, there are also concerns about the experimental status of some features, which may deter some from using them in production environments until they are fully supported.

Highlighted Comments on React 19 and React Compiler

Developers have expressed a particular interest in the integration of React 19 and the new React Compiler, noting improvements in performance and the potential for simplifying their codebases. The automatic optimization features of the React Compiler are seen as a significant advancement, though some caution is advised since it remains in experimental mode.

// Example of enthusiasm for React 19 features
console.log("Excited about React 19's new features and improved performance!");

Concerns and Constructive Criticism

While excitement is high, some developers have shared their concerns about the steep learning curve associated with some of the new features. There’s also a discussion about the need for better documentation and more comprehensive examples to help developers integrate these features more seamlessly into their projects.

Example Comment on Need for Better Documentation

One developer mentioned, “While the new features are exciting, the documentation still feels lacking. More comprehensive guides and real-world examples would help in understanding and implementing these changes effectively.”

Positive Feedback on API and Middleware Enhancements

The enhancements to API routes and middleware have also been well-received. Developers appreciate the increased flexibility and control over server-side processes, which allows for more robust and efficient handling of requests and data.

Sample Developer Reaction to Middleware Updates

“I’m really impressed with the middleware updates. It’s now easier to manage redirects and handle authentication more securely and efficiently.”

Requests for More Stable Features Before Final Release

A recurring theme in the comments is the desire for more stability and fewer breaking changes in the final release. Developers are hopeful that the feedback provided during the RC phase will lead to adjustments that make the final version more stable and reliable for production use.

Community Quote on Stability

“We hope that the Next.js team takes our feedback into account to iron out any issues and ensure stability in the final release. It’s crucial for those of us who rely on Next.js for production projects.”

Community Sources

Next.js 15 RC
byu/matthijsie2020 innextjs

Official Source

Troubleshooting Dependency Conflicts When Upgrading to Next.js 15 RC

Upgrading to a new version of a framework like Next.js 15 RC can sometimes lead to dependency conflicts, especially when paired with other cutting-edge libraries such as React 19 RC. Here’s a simple guide on how to address a common issue reported by developers during their upgrade to Next.js 15 RC, where a dependency conflict arises with React versions.

Understanding the Issue

The error message:

Found: react@19.0.0-rc-935180c7e0-20240524
react@"19.0.0-rc-935180c7e0-20240524" from the root project

Could not resolve dependency:
peer react@"19.0.0-rc-f994737d14-20240522" from next@15.0.0-rc.0
next@"15.0.0-rc.0" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

This error occurs when the version of React installed in your project does not match the version required by the Next.js 15 RC. Next.js expects a specific release candidate version of React, which can cause npm to halt the installation due to the mismatch.

Step-by-Step Solution to Resolve Dependency Issues

  1. Verify React and Next.js Versions: First, ensure that you are indeed trying to install compatible versions of React and Next.js. Check the package.json to confirm the versions listed.
  2. Using --force or --legacy-peer-deps: As suggested in the community, using --force can bypass the npm error. This is a temporary solution and should be used with caution as it may lead to unstable builds.
npm install --force

Alternatively, using --legacy-peer-deps is another approach that tells npm to handle peer dependencies in the way npm v4 to v6 used to handle them, which might avoid the conflict:

npm install --legacy-peer-deps

Manually Aligning Versions: Manually update the versions in your package.json to ensure that both React and Next.js are targeting the release candidates that are expected to work together. You can find the correct versions in the release notes or on the respective package pages on npm.

"dependencies": {
"react": "19.0.0-rc-f994737d14-20240522",
"react-dom": "19.0.0-rc-f994737d14-20240522",
"next": "15.0.0-rc.0"

Clean Install: After aligning the versions, delete your node_modules directory and the package-lock.json or yarn.lock file to clear any cached versions that might cause conflicts.

rm -rf node_modules package-lock.json
npm install

Final Thoughts

Handling version conflicts requires a careful balance between using tools like --force and ensuring that your application dependencies are correctly aligned. For production environments, it’s crucial to ensure that all dependencies are fully compatible without forcing incorrect resolutions, as this could lead to runtime errors and unstable deployments.

If you encounter further issues or need more specific guidance based on your project’s setup, seeking help from the Next.js community or consulting the official Next.js GitHub issues page can provide additional resources and support.

Accelerate your Development


Related Blog