12.3.7

Latest release in branch 12
Released 1 year ago (March 28, 2025)

Software Next.js
Branch 12
Status
End of life
End of life November 21, 2022
First official release version 12.0.0
First official release date 4 years ago (October 26, 2021)
Requirement Node.js 12.22+
Release notes https://nextjs.org/blog/next-12
Source code https://github.com/vercel/next.js/tree/v12.3.7
Download https://www.npmjs.com/package/next/v/12.3.7
Next.js 12 Releases View full list

What Is New in Next.js 12

Next.js 12 delivers a significant performance leap and powerful new primitives for the modern web. The cornerstone is replacing Babel with the Rust-based SWC compiler, bringing up to 3x faster refreshes and 5x faster builds. It also introduces foundational features like Middleware and React 18 support.

Category Key Changes
Core Compiler SWC replaces Babel for compilation and minification, enabling massive speed improvements.
React 18 Support for new features like Suspense SSR and the new root API, paving the way for concurrent features.
Infrastructure Introduction of Middleware (Beta) for code execution before a request is completed.
Native Improvements AVIF image support, URL imports (experimental), and bot-aware ISR fallback.
Developer Experience Improved ESLint integration, smaller installed size, and a refreshed design for the error overlay.

How does the new Rust compiler improve Next.js 12?

The switch to SWC is the most impactful change for developer speed. In practice, you get faster Fast Refresh and significantly quicker production builds. This matters because it reduces feedback time during development, especially in larger applications.

SWC handles both compilation for development and minification for production. The minification step alone is up to 7x faster than Terser. This built-in, Rust-powered toolchain simplifies configuration while unlocking raw performance gains across the board.

What can you build with Next.js Middleware?

Middleware, currently in Beta, runs code before a request reaches your page. It's perfect for operations that need to happen on every request, like authentication, logging, or handling geolocation. You create it in a _middleware.js file at the page or root level.

This feature uses the Web Request and Response APIs, giving you fine-grained control. For example, you can rewrite the request, redirect the user, or add custom headers before the page even starts rendering. It's a powerful, low-level primitive for custom routing and personalization logic.

Does Next.js 12 work with React 18 features?

Yes, Next.js 12 provides support for React 18's new APIs, including the new concurrent features. You can opt into the react@experimental and react-dom@experimental packages to start using features like Suspense for Server-Side Rendering (SSR).

The framework lays the groundwork for streaming SSR, where you can send component HTML as it's ready. This is a foundational upgrade that enables more responsive applications by allowing the client to start rendering earlier, without waiting for the entire page to be ready on the server.

What image and import improvements were added?

The next/image component now supports the AVIF format, which provides significantly better compression than WebP. This means smaller image files and faster page loads for users with supported browsers.

Experimental URL Imports

A new experimental feature allows you to import packages directly from URLs within next.config.js. This bypasses the need for node_modules installation for specific modules, enabling faster, more dynamic dependencies. It's a step towards a more flexible, CDN-based ecosystem.

FAQ

Is the switch from Babel to SWC a breaking change?
For most projects, no. SWC is designed to be a drop-in replacement. However, if you rely on custom Babel plugins, you'll need to find SWC alternatives or temporarily opt-out until SWC plugin support matures.

Can I use Middleware for API routes?
Yes. Middleware runs for both page and API routes. You can place a _middleware.js file inside the /pages/api directory to intercept and process API requests before the route handler runs.

How do I enable React 18 in my existing Next.js 12 project?
First, install the experimental React packages: npm install react@experimental react-dom@experimental. Then, ensure you are using the new root API in your pages/_app.js file. The Next.js team provides detailed upgrade instructions in their blog post.

What happens to my existing Terser configuration for minification?
SWC's minifier is now the default and is significantly faster. Any custom Terser configuration in next.config.js will be ignored. You can disable SWC minification if needed, but the recommendation is to migrate.

What is "bot-aware ISR fallback"?
It's an improvement to Incremental Static Regeneration. When a page hasn't been generated yet, a "fallback" version is shown. Now, the system can detect crawler bots (like Google) and serve them a fully static, waiting page instead of the loading state, which is better for SEO.

Releases In Branch 12

Version Release date
12.3.7 1 year ago
(March 28, 2025)
12.3.6 1 year ago
(March 25, 2025)
12.3.5 1 year ago
(March 23, 2025)
12.3.4 3 years ago
(November 22, 2022)
12.3.3 3 years ago
(November 09, 2022)
12.3.2 3 years ago
(October 30, 2022)
12.2.6 3 years ago
(September 30, 2022)
12.3.1 3 years ago
(September 20, 2022)
12.3.0 3 years ago
(September 08, 2022)
12.2.5 3 years ago
(August 12, 2022)
12.2.4 3 years ago
(August 04, 2022)
12.2.3 3 years ago
(July 22, 2022)
12.2.2 3 years ago
(July 09, 2022)
12.2.1 3 years ago
(July 08, 2022)
12.2.0 3 years ago
(June 28, 2022)
12.1.6 3 years ago
(May 02, 2022)
12.1.5 4 years ago
(April 12, 2022)
12.1.4 4 years ago
(March 31, 2022)
12.1.3 4 years ago
(March 30, 2022)
12.1.2 4 years ago
(March 28, 2022)
12.1.1 4 years ago
(March 25, 2022)
12.1.0 4 years ago
(February 17, 2022)
12.0.10 4 years ago
(February 01, 2022)
12.0.9 4 years ago
(January 26, 2022)
12.0.8 4 years ago
(January 12, 2022)
12.0.7 4 years ago
(December 05, 2021)
12.0.5 4 years ago
(December 04, 2021)
12.0.6 4 years ago
(December 04, 2021)
12.0.4 4 years ago
(November 15, 2021)
12.0.3 4 years ago
(November 05, 2021)
12.0.2 4 years ago
(October 31, 2021)
12.0.1 4 years ago
(October 27, 2021)
12.0.0 4 years ago
(October 26, 2021)