facebook/react · error · Error
react-dom/static is not supported in React Server Components
Error message
react-dom/static is not supported in React Server Components.
What it means
react-dom/static exposes prerender() for producing static HTML outside the RSC runtime. Its react-server condition variant is a stub that throws on import, because inside a Server Components bundle the static-generation pipeline is orchestrated by the framework's build layer, not by user code running in the graph.
Source
Thrown at packages/react-dom/npm/static.react-server.js:3
'use strict'; throw new Error( 'react-dom/static is not supported in React Server Components.' );
View on GitHub (pinned to eafeac097b)
Solutions
- Call prerender() from the framework's designated prerender/SSR entry point, never from Server Component code
- Move the prerender call into a plain Node script or build step that does not use the react-server condition
- Rely on the framework's static generation (static routes, output: 'export') instead of manual prerender calls
Example fix
// before (inside a Server Component module)
import {prerender} from 'react-dom/static';
const {prelude} = await prerender(<Page />);
// after (scripts/prerender.mjs — plain Node, no react-server condition)
import {prerender} from 'react-dom/static';
const {prelude} = await prerender(<Page />); Defensive patterns
Strategy: try-catch
Try / catch
try {
const {prerender} = await import('react-dom/static');
return await prerender(tree);
} catch (e) {
if (e instanceof Error && e.message.includes('not supported in React Server Components')) {
// wrong graph — delegate to the framework's prerender entry instead
return frameworkPrerender(tree);
}
throw e;
} Prevention
- Invoke prerender only from build scripts or framework hooks, not Server Components
- Document which entry points of your app run under the react-server condition
- Keep static-generation logic in the framework layer rather than shared components
When it happens
Trigger: import {prerender} from 'react-dom/static' (or react-dom/static.node / static.edge) from a file compiled under the react-server condition, e.g. calling prerender() inside a Server Component or a module it imports.
Common situations: Frameworks such as Next.js or Waku own the prerender entry point; user code that calls prerender directly from an App Router server file; build scripts sharing modules with Server Components and importing the static entry.
Related errors
- react-dom/profiling is not supported in React Server Compone
- react-dom/server is not supported in React Server Components
- react-dom/unstable_testing is not supported in React Server
- The React Server Writer cannot be used outside a react-serve
- The React Server cannot be used outside a react-server envir
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/cb70ec4d06237f31.
Report an issue: GitHub.