runtime
runtime 路由段配置选项的 API 参考。
runtime 选项允许你选择用于渲染路由的 JavaScript 运行时。
TypeScript
layout.tsx | page.tsx | route.tstsx
export const runtime = 'nodejs'
// 'nodejs'
JavaScript
layout.js | page.js | route.jsjs
export const runtime = 'nodejs'
// 'nodejs'
'nodejs'(默认)'edge'(已弃用)
须知:
- Edge Runtime 已弃用。请从路由文件中移除
runtime导出。参见 Edge Runtime Deprecated。- 启用 Cache Components 后,请移除
runtime导出,包括runtime = 'nodejs'。Cache Components 使用默认的 Node.js 运行时,不支持runtime路由段配置。参见 Migrating to Cache Components。- 此选项不能在 Proxy 中使用。