facebook/react · warning
You did not run Node.js with the `--conditions react-server`
Error message
You did not run Node.js with the `--conditions react-server` flag. Any "react-server" override will only work with ESM imports.
What it means
Identical check in the react-server-dom-unbundled loader (ReactFlightUnbundledNodeLoader.js:82): when the resolve hook does not see 'react-server' among context.conditions, it appends it per-call for ESM resolution and warns once that without the node --conditions react-server flag the override only works for ESM imports, because require() never goes through the hooks.
Source
Thrown at packages/react-server-dom-unbundled/src/ReactFlightUnbundledNodeLoader.js:82
let stashedResolve: null | ResolveFunction = null;
export async function resolve(
specifier: string,
context: ResolveContext,
defaultResolve: ResolveFunction,
): Promise<{url: string}> {
// We stash this in case we end up needing to resolve export * statements later.
stashedResolve = defaultResolve;
if (!context.conditions.includes('react-server')) {
context = {
...context,
conditions: [...context.conditions, 'react-server'],
};
if (!warnedAboutConditionsFlag) {
warnedAboutConditionsFlag = true;
// eslint-disable-next-line react-internal/no-production-logging
console.warn(
'You did not run Node.js with the `--conditions react-server` flag. ' +
'Any "react-server" override will only work with ESM imports.',
);
}
}
return await defaultResolve(specifier, context, defaultResolve);
}
export async function getSource(
url: string,
context: GetSourceContext,
defaultGetSource: GetSourceFunction,
): Promise<{source: Source}> {
// We stash this in case we end up needing to resolve export * statements later.
stashedGetSource = defaultGetSource;
return defaultGetSource(url, context, defaultGetSource);
}
View on GitHub (pinned to eafeac097b)
Solutions
- Run node with --conditions react-server for every process that registers this loader
- Centralize the flag in package.json scripts and CI commands
- Set NODE_OPTIONS='--conditions react-server' for environments you cannot pass CLI flags to
- Ensure the server entry is ESM so the injected condition actually applies
Example fix
// before node --import ./loader.mjs server.cjs // after node --conditions react-server --import ./loader.mjs server.mjs
Defensive patterns
Strategy: validation
Validate before calling
const hasServerCondition = process.execArgv
.join(' ')
.includes('react-server');
if (!hasServerCondition) {
throw new Error('Missing --conditions react-server on the node process');
} Prevention
- Use one canonical start command (package.json script) for dev and prod so the flag cannot drift
- Document that the unbundled loader only fixes ESM resolution
- Add a smoke test that asserts the first server import resolves the server export
When it happens
Trigger: Using register() from react-server-dom-unbundled/server (unbundled RSC protocol) in a node process started without --conditions react-server; first import resolution after registration emits the warning.
Common situations: RSC servers built on the unbundled wire protocol; dev servers restarted by watchers that drop node flags; deployments where the npm start script differs from the local dev command.
Related errors
- You did not run Node.js with the `--conditions react-server`
- You did not run Node.js with the `--conditions react-server`
- Expected resolve to have been called before transformSource
- Expected the transformed source to be a string.
- Attempted to call the default export of ${url} from the serv
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/d41b5bfeaa714046.
Report an issue: GitHub.