{"record":{"id":"d41b5bfeaa714046","repo":"facebook/react","slug":"you-did-not-run-node-js-with-the-conditions-rea-d41b5b","errorCode":null,"errorMessage":"You did not run Node.js with the `--conditions react-server` flag. Any \"react-server\" override will only work with ESM imports.","messagePattern":"You did not run Node\\.js with the `--conditions react-server` flag\\. Any \"react-server\" override will only work with ESM imports\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/react-server-dom-unbundled/src/ReactFlightUnbundledNodeLoader.js","lineNumber":82,"sourceCode":"let stashedResolve: null | ResolveFunction = null;\n\nexport async function resolve(\n  specifier: string,\n  context: ResolveContext,\n  defaultResolve: ResolveFunction,\n): Promise<{url: string}> {\n  // We stash this in case we end up needing to resolve export * statements later.\n  stashedResolve = defaultResolve;\n\n  if (!context.conditions.includes('react-server')) {\n    context = {\n      ...context,\n      conditions: [...context.conditions, 'react-server'],\n    };\n    if (!warnedAboutConditionsFlag) {\n      warnedAboutConditionsFlag = true;\n      // eslint-disable-next-line react-internal/no-production-logging\n      console.warn(\n        'You did not run Node.js with the `--conditions react-server` flag. ' +\n          'Any \"react-server\" override will only work with ESM imports.',\n      );\n    }\n  }\n  return await defaultResolve(specifier, context, defaultResolve);\n}\n\nexport async function getSource(\n  url: string,\n  context: GetSourceContext,\n  defaultGetSource: GetSourceFunction,\n): Promise<{source: Source}> {\n  // We stash this in case we end up needing to resolve export * statements later.\n  stashedGetSource = defaultGetSource;\n  return defaultGetSource(url, context, defaultGetSource);\n}\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-unbundled/src/ReactFlightUnbundledNodeLoader.js#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nnode --import ./loader.mjs server.cjs\n\n// after\nnode --conditions react-server --import ./loader.mjs server.mjs","handlingStrategy":"validation","validationCode":"const hasServerCondition = process.execArgv\n  .join(' ')\n  .includes('react-server');\nif (!hasServerCondition) {\n  throw new Error('Missing --conditions react-server on the node process');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["react-server","server-components","node-loader","esm","module-resolution","conditions-flag"],"backgroundTag":"react-server-conditions-flag","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}