From 6e4ac3c0f404962a3e0e996d3d278a3837115ef9 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Fri, 8 Apr 2022 18:26:14 +0200 Subject: [PATCH] Update the docs for Switchable Runtime (#36015) As per the feedback in #35952. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` --- docs/advanced-features/react-18/switchable-runtime.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/advanced-features/react-18/switchable-runtime.md b/docs/advanced-features/react-18/switchable-runtime.md index 93036fab8b9d7..458ad86664e74 100644 --- a/docs/advanced-features/react-18/switchable-runtime.md +++ b/docs/advanced-features/react-18/switchable-runtime.md @@ -1,6 +1,6 @@ # Switchable Runtime (Alpha) -By default, Next.js uses Node.js as the runtime for page rendering, including pre-rendering, server-side rendering. +By default, Next.js uses Node.js as the runtime for page rendering, including pre-rendering and server-side rendering. If you have [React 18](/docs/advanced-features/react-18/overview) installed, there is a new experimental feature that lets you switch the page runtime between Node.js and the [Edge Runtime](/docs/api-reference/edge-runtime). Changing the runtime affects [SSR streaming](/docs/advanced-features/react-18/streaming) and [Server Components](/docs/advanced-features/react-18/server-components) features, as well. @@ -19,7 +19,7 @@ module.exports = { This option determines which runtime should be used as the default rendering runtime for all pages. -## Per-page Runtime Option +## Page Runtime Option On each page, you can optionally export a `runtime` config set to either `'nodejs'` or `'edge'`: @@ -32,3 +32,5 @@ export const config = { When both the per-page runtime and global runtime are set, the per-page runtime overrides the global runtime. If the per-page runtime is _not_ set, the global runtime option will be used. You can refer to the [Switchable Next.js Runtime RFC](https://github.com/vercel/next.js/discussions/34179) for more information. + +**Note:** The page runtime option is not supported in [API Routes](/docs/api-routes/introduction.md) currently.