Next.js, a framework for building applications that leverage the , is getting a refresh. adds capabilities including incremental static regeneration and rewrites/redirects support.
Incremental static regeneration updates pages by re-rendering them in the background as traffic flows in. Traffic is served uninterrupted, statically, with the newly built page pushed only after it is done generating. Benefits include no spikes in latency and pages never going offline.
Support for rewrites aids in incremental adoption of Next.js, allowing developers to make an incoming request with a different destination path, including external URLs. Support for redirects, which are used in situations such as changing the structure of application routes, takes the form of a list of redirects in
next.config.js under the
Developed by edge network provider , open source Next.js is intended as an enterprise-level tool for purposes including building static websites, pre-rendered apps and mobile web apps.
Other new features and improvements in Next.js 9.5:
basePathconfiguration option enables easy hosting of a Next.js application on a subpath of a domain. Developers may want to host an application under a subpath such as
/docsso the application only covers that subsection of a domain.
trailingSlashoption is offered as part of
next.config.js. When this option is set to
true, Next.js will automatically add a trailing slash to URLs.
- Fast Refresh, introduced in Next.js 9.4, has been refined to show more helpful application error messages.
- Production React profiling. A previously introduced Profiler API enabled tracking of performance issues in React components, but required a separate version of ReactDOM to be used to profile in production. With Next.js 9.5, developers can automatically set up correct aliases for
- Optional catch-all dynamic routes provide more flexibility and choice in application routing needs. The feature is labeled as experimental in .
- Beta support is offered for the Webpack 5 module bundler, which has improvements such as better tree-shaking and persistent caching.
Copyright © 2020 IDG Communications, Inc.