I’m pleased to share that version 4.0.0 of the Essential Next.js plugin has now been released. Huge thanks to everybody who has helped with beta testing over the past month. There have been an incredible 275 comments in the beta discussion topic.
If you haven’t checked out the beta, you’re in for a treat, as version 4 is packed full of new features. It’s a complete rewrite, with a new architecture that is more stable, faster to build and deploy, and with full support for loads more Next.js features. Thanks to everyone who helped test all of these!
We also have one extra special added feature that wasn’t in the beta: full support for ISR! This has been the number one feature request since the first days of Next on Netlify, and we’re super excited to be able to share this with you. This is available because of the new support for time to live (TTL) in Netlify On Demand Builders, and is a great addition for large sites in particular.
Here is a run-down of the main new features in version 4:
Full support for incremental static regeneration (ISR).
Full support for Next.js rewrites, redirects and headers.
Beta support for Next 12 Middleware
Faster builds and deploys. Instead of generating one function per route, there are just three functions per site and a much smaller list of rewrites.
Full support for Netlify’s new persistent On-Demand Builders. Return
getStaticPathsand your rendering will be deferred until the first page load, then persisted globally.
A new image server for next/image, built on Nuxt’s ipx. This is a high-performance, framework-agnostic image server based on sharp. This implementation uses On-Demand Builders to persist transformed images globally. Improved source image caching reduces time to first byte for new transforms.
Simplified configuration. You no longer need to set any Netlify-specific configuration options. For example, in a monorepo all you need to do is set
publishto point to your
.nextdirectory and you can build the site in any way you like.
Removes requirement for the
targetto be set to
serverless, which is deprecated in Next 12.
Bundling now uses Next.js’s own Node File Trace, giving more predictable results and smaller uploads.
New Next.js sites will have this version installed today. Because this is a major version bump, existing sites won’t be upgraded automatically, but you can click the button on your dashboard to update it. You can also install it from npm:
npm add -D @netlify/plugin-nextjs@latest
There is one configuration change that you need to make, which is to change the
publish directory from
.next. You can do this in the Netlify UI or in
[build] publish = ".next"
You can also remove most special configuration that you might have added, as it should now all work out of the box. For more information, see the release notes.
If you have feedback, please open an issue or start a discussion in the plugin repo