Skip to main content

运行时

Next.js 有两种您可以在应用程序中使用的服务器运行时:

  • Node.js Runtime (默认) 可以访问生态系统中所有的 Node.js APIs 和 兼容的 packages。
  • Edge Runtime 包含一组更有限的APIs

案例

  • Node.js 运行时用于渲染应用程序
  • Edge 运行时用于 Middleware (路由规则,如 redirects、rewrites 和 setting headers)。

注意事项

  • Edge 运行时不支持所有的 Node.js APIs。因此某些 packages 将无法运行。了解更多关于Edge Runtime中不支持的 API。
  • Edge 运行时不支持 Incremental Static Regeneration (ISR)。
  • 根据您的部署基础架构,这两种运行时都能够支持streaming