Next.js 8 now supports serverless apps

The JavaScript and React framework also reduces build-time memory usage and speeds static export

Next.js 8 now supports serverless apps
Thinkstock

Next.js, a framework for building server-rendered apps with JavaScript and the React UI library, adds serverless computing capabilities as part of its new Version 8.

Next.js 8 enables serverless deployment, in which applications are split into smaller parts, or lambdas, that let code be run on demand and scale automatically. In Next.js Version 8, each page in the pages directory becomes a serverless lambda. A low-level API is available for serverless deployment.

Other new and improved features in Next.js Version 8 include:

  • Build-time memory usage reduction, made via contributions to the Webpack module bundler. This has resulted in 16 times better memory usage without any degradation in performance, according to developer Zeit.
  • Prefetch performance improvements, with the Next.js router enabling prefetching of pages for quicker navigation.
  • Smaller HTML size, with the initial payload size reduced.
  • Faster static export, in which static rendering through next export will be faster on multi-CPU machines. Static rendering is done to output files that can be served directly without code execution on the server. The number of CPU cores will be detected automatically and pages distributed accordingly.
  • An inline JavaScript tag for passing data has been changed to a JSON tag for safe transfer to the client. With previous versions of Next.js, enabling the Content Security Policy security layer required enabling script-src unsafe-inline in their policy, with Next.js creating an inline <script> tag. The change means there are no more inline scripts included by Next.js.
  • An API authentication example is included to show how to authenticate against an external API in any programming language.

Where to download Next.js

You can find Next.js setup instructions at Nextjs.org.

Copyright © 2019 IDG Communications, Inc.