{"record":{"id":"adf60cedc2008dc4","repo":"facebook/react","slug":"you-did-not-run-node-js-with-the-conditions-rea-adf60c","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-webpack/src/ReactFlightWebpackNodeLoader.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-webpack/src/ReactFlightWebpackNodeLoader.js#L64-L100","documentation":"The webpack-flavored RSC node loader (react-server-dom-webpack, ReactFlightWebpackNodeLoader.js:82) carries the same resolve hook: it needs the 'react-server' export condition to pick server bundles of client-referenced modules. When node lacks --conditions react-server, the hook injects the condition only for specifiers it resolves and warns once that anything loaded through CommonJS require() keeps resolving without it.","triggerScenarios":"A node SSR/RSC server that registers the react-server-dom-webpack loader (typically alongside a webpack build with 'react-server' condition exports) but is started without --conditions react-server.","commonSituations":"Webpack-based RSC setups where the dev script was updated but the production/Docker start command was not; CJS server bundles produced by the same webpack build resolving different versions in dev vs prod.","solutions":["Add --conditions react-server to the node invocation for dev, build-time, and runtime scripts","Verify with `node -p \"process.execArgv\"` in the target environment that the flag survived","Use NODE_OPTIONS when launching through process managers","Make sure the packages that need the condition expose it via ESM exports maps"],"exampleFix":"// before\nCMD [\"node\", \"dist/server.js\"]\n\n// after\nCMD [\"node\", \"--conditions\", \"react-server\", \"dist/server.js\"]","handlingStrategy":"validation","validationCode":"// in the server bootstrap, before any client-reference import\nif (!process.execArgv.join(' ').includes('react-server')) {\n  console.error('restart with: node --conditions react-server');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Mirror the flag into Docker CMD, CI, and pm2 ecosystem files","Give the webpack build and the node process the same conditions to avoid dev/prod drift","Assert the condition in a startup self-check so misconfiguration fails loudly"],"tags":["react-server","server-components","webpack","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"}