Update 02-edge-and-nodejs-runtimes.mdx (#52888)

Added clarification that runtime edge can be defined on Layout level too.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
This commit is contained in:
Steven Tey 2023-07-19 09:41:01 -05:00 committed by GitHub
parent 91c31c69b0
commit 55fdfe4280
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,16 @@ export const runtime = 'edge' // 'nodejs' (default) | 'edge'
export const runtime = 'edge' // 'nodejs' (default) | 'edge'
```
You can also define `runtime` on a layout level, which will make all routes under the layout run on the edge runtime:
```tsx filename="app/layout.tsx" switcher
export const runtime = 'edge' // 'nodejs' (default) | 'edge'
```
```jsx filename="app/layout.js" switcher
export const runtime = 'edge' // 'nodejs' (default) | 'edge'
```
If the segment runtime is _not_ set, the default `nodejs` runtime will be used. You do not need to use the `runtime` option if you do not plan to change from the Node.js runtime.
</AppOnly>