Overview:
The Next.js Runtime package handles the build process and creates the runtime environment for Next.js sites on Netlify. It is automatically used during builds, so manual installation is usually unnecessary. Next.js is natively supported on Netlify, and the repository includes the necessary packages for this support. Prerequisites for using Next.js on Netlify include having Next.js 13.5 or later, Node.js 18 or later, and the latest version of the Netlify CLI.
Features:
- Automated Build Process: Next.js Runtime automates the build process for Next.js sites on Netlify.
- Native Support on Netlify: Next.js is supported natively on Netlify, reducing the need for manual installation or configuration.
- Auto-Upgrade: Manual installation of Next.js Runtime allows for pinning to a specific version for stability.
Installation:
To manually install the Next.js Runtime for Netlify, you can choose between two methods:
From the UI (Recommended):
- Access the UI and select the site where you want to install the Next.js Runtime. This method is recommended for benefitting from auto-upgrades.
From npm:
- Add the following code snippet to your netlify.toml file:
[build] publish = "out" command = "npm run build" functions = "out/functions"
- If you wish to specify a version, use v4 for Next.js 10-13.4 or Node.js < 18.
- For upgrading from v4 to v5, refer to the v5 documentation.
- Add the following code snippet to your netlify.toml file:
Summary:
Next.js Runtime simplifies the build process and provides the necessary runtime environment for Next.js sites on Netlify. It offers automation, native support, and easy manual installation options for users. Prerequisites and version-specific details should be considered when installing or upgrading the Next.js Runtime.