{"record":{"id":"76bca33cd5cc60ae","repo":"facebook/react","slug":"492","errorCode":"492","errorMessage":"The \"react\" package in this environment is not configured correctly. The \"react-server\" condition must be enabled in any environment that runs React Server Components.","messagePattern":"The \"react\" package in this environment is not configured correctly\\. The \"react-server\" condition must be enabled in any environment that runs React Server Components\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/react-server/src/ReactSharedInternalsServer.js","lineNumber":20,"sourceCode":" * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';\n\nimport * as React from 'react';\n\nconst ReactSharedInternalsServer: SharedStateServer =\n  // $FlowFixMe[incompatible-type]: It's defined in the one we resolve to.\n  // $FlowFixMe[missing-export]\n  React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;\n\nif (!ReactSharedInternalsServer) {\n  throw new Error(\n    'The \"react\" package in this environment is not configured correctly. ' +\n      'The \"react-server\" condition must be enabled in any environment that ' +\n      'runs React Server Components.',\n  );\n}\n\nexport default ReactSharedInternalsServer;\n","sourceCodeStart":2,"sourceCodeEnd":28,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactSharedInternalsServer.js#L2-L28","documentation":"The react-server package imports React's server-only internals (React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE), which exist only in the react build selected by the 'react-server' export condition. If the plain browser/node react build is resolved instead, the field is undefined and this error fires at module load — before any rendering happens. It is the canonical 'your bundler did not apply the react-server condition' failure.","triggerScenarios":"Bundling server code that imports react-server-dom-*/server (or anything exporting a react-server condition) with webpack/vite/esbuild/jest configs lacking 'react-server' in conditionNames/conditions/customExportConditions; test runners resolving default conditions while importing RSC modules.","commonSituations":"Custom SSR+RSC setups without a framework; adding RSC to an existing Vite/esbuild server bundle; jest/vitest tests importing server components; consuming packages that publish a react-server export without configuring the condition.","solutions":["Add 'react-server' to the server bundle's resolution conditions (webpack resolve.conditionNames, Vite resolve.conditions, esbuild --conditions, jest testEnvironmentOptions.customExportConditions).","Keep RSC server code in a separate entry/bundle from client code so conditions do not leak across.","If a framework (Next.js, Waku) is present, import RSC APIs through it rather than configuring conditions by hand."],"exampleFix":"// before — webpack server config\nresolve: {}\n\n// after\nresolve: { conditionNames: ['react-server', 'node', 'import', 'default'] }","handlingStrategy":"validation","validationCode":"// Startup canary with an actionable message, in your server bootstrap:\nimport * as React from 'react';\nif (!(React as any).__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) {\n  throw new Error(\n    'react resolved without the react-server export condition — add it to this bundle\\'s ' +\n    'resolve conditions (webpack conditionNames / Vite resolve.conditions / esbuild --conditions)'\n  );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List 'react-server' in every server-side resolve configuration (webpack conditionNames, Vite resolve.conditions, esbuild --conditions, jest customExportConditions).","Keep a CI smoke test that boots the built server bundle.","Scope the condition to server bundles only — applying it to the client bundle breaks hydration."],"tags":["bundler","export-conditions","react-server","configuration","module-resolution"],"backgroundTag":"bundler-export-conditions","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}