NNext.js 中文网 GitHub

runtime

runtime 路由段配置选项的 API 参考。

runtime 选项允许你选择用于渲染路由的 JavaScript 运行时。

layout.tsx | page.tsx | route.ts
export const runtime = 'nodejs'
// 'nodejs'
layout.js | page.js | route.js
export const runtime = 'nodejs'
// 'nodejs'
  • 'nodejs'(默认)
  • 'edge'(已弃用)

小知识:

  • Edge Runtime 已弃用。请从路由文件中移除 runtime 导出。请参阅 Edge Runtime 已弃用。
  • 启用 Cache Components 时,请移除 runtime 导出,包括 runtime = 'nodejs'。Cache Components 使用默认的 Node.js 运行时,不支持 runtime 路由段配置。请参阅迁移到 Cache Components。
  • 此选项不能在 Proxy 中使用。