8.1.0

Latest release in branch 8
Released 7 years ago (April 17, 2019)

Software Next.js
Branch 8
Status
End of life
First official release version 8.0.0
First official release date 7 years ago (February 11, 2019)
Requirement Node.js 8+
Release notes https://nextjs.org/blog/next-8
Source code https://github.com/vercel/next.js/tree/v8.1.0
Download https://www.npmjs.com/package/next/v/8.1.0
Next.js 8 Releases View full list

What Is New in Next.js 8

Next.js 8 delivers a foundational shift with its new serverless target and significant performance optimizations for both development and production. It brings official support for React Hooks and streamlines the developer experience with improved error reporting and build output.

Category Key Changes
New Feature Serverless Deployment Target
New Feature Official React Hooks Support
Improvement Faster Builds & Lighter Output
Improvement Enhanced Error Overlay & Reporting
Improvement Dynamic Route Performance
Under the Hood Webpack 4 & Babel 7 Integration

How does serverless deployment work in Next.js 8?

Next.js 8 introduces a first-class target: 'serverless' configuration. This changes how the application is built and deployed. Instead of generating a monolithic Node.js server, the build process outputs standalone serverless functions for each page in your pages directory.

The Practical Impact

Each page becomes its own lambda function, enabling massive scalability and cost efficiency on platforms like Vercel, AWS Lambda, or Google Cloud Functions. In practice, this means your application can handle sudden traffic spikes more gracefully, as each page scales independently. The cold start time for these functions is a primary consideration, but the overall architecture aligns with modern cloud-native principles.

What performance gains come with the new build system?

The update to Webpack 4 and Babel 7 is the engine behind significant performance improvements. Build times are faster, and the final client-side bundles are smaller and more optimized.

Build Output and Dynamic Routing

You'll notice a lighter .next directory after a build. The system also generates a build-manifest.json file, which helps optimize runtime asset loading. For dynamic routes, the performance is enhanced because the framework now intelligently prefetches only the necessary data for linked pages, reducing unnecessary overhead during client-side navigation.

How are React Hooks integrated and supported?

With React 16.8, Hooks are now fully supported within Next.js components. You can use useState, useEffect, and custom Hooks directly in your functional page and component files without any special configuration from Next.js.

This matters because it streamlines state and lifecycle management in functional components, making code more reusable and concise. The development overlay has also been updated to provide better error messages for common Hook misuse, which accelerates debugging.

What improvements were made to the developer experience?

The development error overlay received a major upgrade. It now displays more informative error and warning messages, often with links to relevant documentation, directly in the browser.

Additionally, the next CLI provides clearer output during builds and development server startup. These changes reduce the time developers spend deciphering cryptic errors, letting them focus on writing code instead of configuring tooling.

FAQ

Should I switch my existing Next.js project to the serverless target?
It depends on your hosting platform and scale needs. The serverless target is ideal for platforms that support it (like Vercel) and for applications with variable traffic. For consistent, high-volume traffic on a dedicated Node server, the default multi-threaded target might still be more appropriate due to cold start considerations.

Does the Webpack 4 upgrade require changes to my custom webpack config?
Potentially, yes. If you've ejected or heavily customized your Webpack configuration, you may need to adjust it for compatibility with Webpack 4's updated API and plugin system. Most standard configurations should work without issue, but testing your build is recommended.

Are there any breaking changes with dynamic routes in Next.js 8?
No breaking changes, but there are performance improvements. The way data is prefetched for next/link components linked to dynamic routes is more efficient, which can lead to faster page transitions in your application.

How do I enable the serverless build mode?
Add the target: 'serverless' field to your next.config.js file. Your build will then output a serverless directory inside .next containing the individual lambda functions for each page.

// next.config.js
module.exports = {
  target: 'serverless'
}

Does better Hooks support mean class components are deprecated?
Not at all. Next.js 8 maintains full backward compatibility with class components. The enhanced support simply means you can confidently adopt Hooks in new components or refactor existing ones at your own pace, using the patterns that best suit your project.

Releases In Branch 8

Version Release date
8.1.0 7 years ago
(April 17, 2019)
8.0.4 7 years ago
(April 02, 2019)
8.0.2 7 years ago
(February 22, 2019)
8.0.3 7 years ago
(February 22, 2019)
8.0.1 7 years ago
(February 13, 2019)
8.0.0 7 years ago
(February 11, 2019)