4.2.3

Latest release in branch 4
Released 8 years ago (January 13, 2018)

Software Next.js
Branch 4
Status
End of life
First official release version 4.0.0
First official release date 8 years ago (October 09, 2017)
Requirement Node.js 6+
Release notes https://nextjs.org/blog/next-4
Source code https://github.com/vercel/next.js/tree/4.2.3
Download https://www.npmjs.com/package/next/v/4.2.3
Next.js 4 Releases View full list

What Is New in Next.js 4

Next.js 4 focuses on speed and developer experience, delivering a significantly faster build process and a leaner production runtime. The core updates revolve around performance optimizations, React 16 compatibility, and foundational improvements to the bundling system.

Category Key Changes
Performance Up to 4x faster builds with Webpack 3, reduced bundle size, and faster hot reloading.
Core Features Full support for React 16 and styled-jsx version 2.
Improvements Enhanced error reporting, improved next/router prefetching, and better static export behavior.
Bug Fixes Multiple fixes for CSS, routing, and build-related issues.

How does Next.js 4 improve build performance?

The most immediate impact is build speed. By upgrading to Webpack 3 and implementing scope hoisting, Next.js 4 cuts build times dramatically. In practice, this means your development feedback loop tightens, and production deployments finish quicker.

Bundle sizes are also reduced due to better tree-shaking and module concatenation. This directly translates to faster page loads for your users, as the JavaScript payload sent to the browser is smaller and more optimized.

What does React 16 support enable?

Next.js 4 brings full compatibility with React 16. This allows you to use new features like fragments, error boundaries, and improved server-side rendering. You can now return arrays from component render methods without wrapping them in an extra element.

Support for portals and custom DOM attributes is also included. This matters because it keeps your Next.js stack aligned with the latest React ecosystem, ensuring access to performance improvements and new APIs.

Are there updates to styled-jsx?

Yes, styled-jsx has been upgraded to version 2. This update introduces support for dynamic styles via the new jsx global and allows passing styles as props. The syntax becomes more flexible for managing component-scoped CSS.

// Dynamic styles with styled-jsx v2
const Button = ({ color }) => (
  <button>
    Click me
    <style jsx>{`
      button {
        background: ${color};
      }
    `}</style>
  </button>
);

What routing and error handling improvements were made?

The next/router prefetching logic is now smarter, prefetching pages more efficiently to improve perceived performance. Error reporting is also enhanced, providing clearer stack traces and messages when something breaks during development or build.

Static Export Behavior

The next export command sees improvements in how it handles dynamic routes and asset paths, making it more reliable for generating fully static sites from a Next.js application.

FAQ

Is upgrading to Next.js 4 from version 3 straightforward?
Generally, yes. The upgrade path is smooth for most applications. The main steps are updating the next and react dependencies in your package.json. Always check for breaking changes in the release notes related to any custom Webpack configuration.

Do I need to change my code for styled-jsx v2?
Most existing styled-jsx CSS will work without modification. You only need to update your code if you want to use the new dynamic styling features or the jsx global. Review the styled-jsx v2 documentation for new APIs.

How significant is the 4x faster build claim?
The speedup is very noticeable in medium to large projects. The improvement comes from Webpack 3's scope hoisting, which reduces module overhead. Your mileage may vary based on project size and structure, but the build performance gain is a major win.

Can I use React 16 features like fragments immediately?
Absolutely. Once you upgrade Next.js and React, you can immediately start using React 16 features such as <React.Fragment> or the shorthand <> syntax within your pages and components.

Are there any deprecated APIs in this release?
Next.js 4 itself doesn't heavily deprecate its own APIs. The focus is on addition and optimization. However, always ensure any third-party plugins you use are compatible with Webpack 3 and React 16.

Releases In Branch 4

Version Release date
4.2.3 8 years ago
(January 13, 2018)
4.3.0-zones.1 8 years ago
(January 11, 2018)
4.2.2 8 years ago
(January 09, 2018)
4.3.0-universal-alpha.2 8 years ago
(January 09, 2018)
4.3.0-universal-alpha.3 8 years ago
(January 09, 2018)
4.3.0-universal-alpha.4 8 years ago
(January 09, 2018)
4.3.0-universal-alpha.1 8 years ago
(January 06, 2018)
4.2.1 8 years ago
(December 09, 2017)
4.2.0 8 years ago
(December 05, 2017)
4.2.0-zones.2 8 years ago
(November 27, 2017)
4.1.4 8 years ago
(October 29, 2017)
4.1.3 8 years ago
(October 22, 2017)
4.1.2 8 years ago
(October 20, 2017)
4.1.1 8 years ago
(October 19, 2017)
4.1.0 8 years ago
(October 16, 2017)
4.0.4 8 years ago
(October 15, 2017)
4.0.5 8 years ago
(October 15, 2017)
4.0.3 8 years ago
(October 11, 2017)
4.0.2 8 years ago
(October 10, 2017)
4.0.0 8 years ago
(October 09, 2017)
4.0.1 8 years ago
(October 09, 2017)
4.0.0-beta.6 8 years ago
(October 08, 2017)
4.0.0-beta.5 8 years ago
(October 07, 2017)
4.0.0-beta.4 8 years ago
(October 06, 2017)
4.0.0-beta.3 8 years ago
(October 04, 2017)
4.0.0-beta.1 8 years ago
(September 28, 2017)
4.0.0-beta.2 8 years ago
(September 28, 2017)