{"record":{"id":"fe22a41c633bdc35","repo":"facebook/react","slug":"the-react-server-writer-cannot-be-used-outside-a-r-fe22a4","errorCode":null,"errorMessage":"The React Server Writer cannot be used outside a react-server environment. You must configure Node.js using the `--conditions react-server` flag.","messagePattern":"The React Server Writer cannot be used outside a react-server environment\\. You must configure Node\\.js using the `--conditions react-server` flag\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server-dom-parcel/npm/static.js","lineNumber":3,"sourceCode":"'use strict';\n\nthrow new Error(\n  'The React Server Writer cannot be used outside a react-server environment. ' +\n    'You must configure Node.js using the `--conditions react-server` flag.'\n);\n","sourceCodeStart":1,"sourceCodeEnd":7,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-parcel/npm/static.js#L1-L7","documentation":"npm/static.js is the non-react-server fallback of the './static' export. Like the server entry, it throws on evaluation unless Node resolved the specifier with the react-server condition, guaranteeing the static Flight renderer only runs in a react-server environment.","triggerScenarios":"Importing 'react-server-dom-parcel/static' without --conditions react-server; deep-importing the built static.js file; bundler resolving the default condition for code that pulls the static renderer.","commonSituations":"Forgetting the flag in dev/test/prod scripts; bundlers resolving the static entry for a client bundle; upgrading the package when the condition gates were introduced.","solutions":["Start the process with --conditions react-server","Import the explicit 'react-server-dom-parcel/static.node' / 'static.edge' / 'static.browser' variant","Keep react-server out of conditionNames for any browser/client bundle and in for server builds"],"exampleFix":"// before\nnode --experimental-modules build.mjs // imports react-server-dom-parcel/static\n\n// after\nnode --conditions react-server build.mjs","handlingStrategy":"validation","validationCode":"const flags = process.execArgv.concat((process.env.NODE_OPTIONS || '').split(' '));\nif (!flags.some(a => a.includes('react-server'))) {\n  throw new Error('Start with --conditions react-server before loading react-server-dom-parcel/static');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const staticRenderer = await import('react-server-dom-parcel/static');\n} catch (e) {\n  if (/react-server environment/.test(e.message)) {\n    throw new Error('Restart with --conditions react-server');\n  }\n  throw e;\n}","preventionTips":["Run static prerender scripts with --conditions react-server","Prefer the explicit .node/.edge/.browser static subpaths in mixed environments","Check conditions at process start, not after the first import"],"tags":["react-server","conditions","node","package-exports","parcel"],"backgroundTag":"missing-react-server-condition","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}