facebook/react · critical · Error

492

492

Error message

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.

What it means

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.

Source

Thrown at packages/react-server/src/ReactSharedInternalsServer.js:20

 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';

import * as React from 'react';

const ReactSharedInternalsServer: SharedStateServer =
  // $FlowFixMe[incompatible-type]: It's defined in the one we resolve to.
  // $FlowFixMe[missing-export]
  React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;

if (!ReactSharedInternalsServer) {
  throw new Error(
    '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.',
  );
}

export default ReactSharedInternalsServer;

View on GitHub (pinned to eafeac097b)

Solutions

  1. Add 'react-server' to the server bundle's resolution conditions (webpack resolve.conditionNames, Vite resolve.conditions, esbuild --conditions, jest testEnvironmentOptions.customExportConditions).
  2. Keep RSC server code in a separate entry/bundle from client code so conditions do not leak across.
  3. If a framework (Next.js, Waku) is present, import RSC APIs through it rather than configuring conditions by hand.

Example fix

// before — webpack server config
resolve: {}

// after
resolve: { conditionNames: ['react-server', 'node', 'import', 'default'] }
Defensive patterns

Strategy: validation

Validate before calling

// Startup canary with an actionable message, in your server bootstrap:
import * as React from 'react';
if (!(React as any).__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) {
  throw new Error(
    'react resolved without the react-server export condition — add it to this bundle\'s ' +
    'resolve conditions (webpack conditionNames / Vite resolve.conditions / esbuild --conditions)'
  );
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/76bca33cd5cc60ae. Report an issue: GitHub.