next.js
0ec83465 - [Experiment] Generate the entry for pages on the native RSC runtime

Commit
14 hours ago
[Experiment] Generate the entry for pages on the native RSC runtime Scaffolding for an experiment: the native RSC runtime, a highly experimental runtime for rendering React Server Components on the server. None of it is usable yet. A page with `experimental_nativeRscRuntime = true` now gets its own Turbopack entry. The template imports nothing from App Router: only the renderer's precompiled bundles (the SSR one through the `next-ssr` transition, so it resolves React for Fizz), the root layout, and the page. It imports each bundle through a small module that picks the `prod` or `dev` bundle by `process.env.NODE_ENV`, with a `require()` in each branch of an `if`/`else`, as `module.compiled.js` does, so the app's build keeps only the bundle for its mode. It has no request handler yet: serving the page is a later step, which adds the bridge. Until then the page still fails to build with "isn't implemented yet", and the entry's own errors are reported alongside it. The first phase supports only one shape of route, a page directly inside the root layout, so the wiring can land before any features do. Other file structure and segment exports are left out on purpose, and a route that uses them is a build error, never a fallback to App Router: `next dev`, `runtime = 'edge'`, a root layout other than `app/layout` (in a route group or a dynamic segment), segments between the root layout and the page, parallel routes, including a page that's only in a slot, `error`/`loading`/`template`/`not-found` and the other special files, metadata files anywhere in the route's tree, including `favicon` and a root `sitemap`, and `metadata`/`viewport` exports and their `generate…` functions (now recorded by segment config parsing), `ensureStatic`, and `instant`. So are client components and CSS: the endpoint already computes a page's client references, and a page on the runtime with any, including a `"use client"` root layout or page, is an error at the page. Each error points at the file that causes it, and one build reports them all. Server actions aren't checked: nothing serves these pages yet, and the bridge, when it does, answers a POST with a 405 before the page renders. The checks are coarse by design; later steps lift them one at a time as the runtime supports each feature, so the e2e suite checks them together in one build rather than one build each. `next build` doesn't prerender these pages, also on purpose for the first phase. The build reads the export from the page's static info, with layout inheritance, the way it reads `runtime`, and tells the static worker the page is dynamic without loading it, as it does for Go route handlers.
References
Author
Committer
Parents
Loading