BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Next.js 9.5 Improves Static Site Regeneration Performance

Next.js 9.5 Improves Static Site Regeneration Performance

This item in japanese

Bookmarks

Next.js, the open-source React-based framework from Vercel, adds several static site generation performance improvements in the Next.js 9.5 release. The release also allows developers to optionally opt-in to Webpack 5 beta for smaller and faster builds.

Like many modern JavaScript frameworks, Next.js introduced static site generation capabilities in its 9.3 release. With version 9.5, Next.js adds incremental static site generation to provide several new options, including the rapid rebuilding of static pages after deployment rather than needing to rebuild an entire static site.

One technique introduced with this update allows existing static pages to get re-rendered as traffic requests those pages to eliminate interruption in accessing pages on a site. Compared to traditional static site rendering, there are no spikes in latency, pages never go offline, and the database and back-end performance are efficient.

Another group of changes introduced in Next.js 9.5 is related to configuring the base path, optional trailing slashes in URLs, and support for rewrites, redirects, and request headers.

Next.js 9.5 introduces persistent caching for page bundles, leveraging a content hash instead of a build identifier. This content hash allows pages caching across releases when the JavaScript bundles are unchanged.

Building on a fast refresh approach for hot module loading introduced in Next.js 9.4, the 9.5 release provides better developer tooling for error messages, component state, and information for easier troubleshooting. Next.js 9.5 also leverages the React Profiler API to identify production performance issues.

While webpack 5 remains in beta, Next.js 9.5 provides optional support to leverage improvements in the forthcoming webpack release, including improved tree-shaking, persistent caching, and deterministic chunk and module identifiers. To leverage webpack 5 beta, users will update their package.json to specify a specific webpack version. Several refinements in Next.js 9.5 help support webpack 5, including the removal of various webpack middleware dependencies. Upgrades to webpack 5 should be straightforward, though developers using custom webpack configurations will need to verify their configuration's compatibility.

Community response to the Next.js 9.5 release is very positive and surrounds the improvements to static site generation and incremental re-rendering.

Next.js is open-source software available under the MIT license. Contributions are welcome via the Next.js GitHub repo following the Next.js contribution guidelines and code of conduct.

Rate this Article

Adoption
Style

BT