facebook/react · error

Use react-server-dom-esm/client instead.

Error message

Use react-server-dom-esm/client instead.

What it means

The root entrypoint of react-server-dom-esm (source packages/react-server-dom-esm/index.js) is a guard file containing nothing but this throw directing you to the client subpath. The package intentionally has no default entry because its server and client runtimes live behind different Node export conditions, so every import must name a subpath explicitly.

Source

Thrown at packages/react-server-dom-esm/index.js:10

/**
 * 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
 */

throw new Error('Use react-server-dom-esm/client instead.');

View on GitHub (pinned to eafeac097b)

Solutions

  1. Import the RSC client from 'react-server-dom-esm/client' (createFromFetch, createFromReadableStream, createFromNodeStream)
  2. Import server-side APIs from 'react-server-dom-esm/server' and run under the react-server condition
  3. Fix bundler/jest aliases so the bare specifier never resolves to the guard file

Example fix

// before
import {createFromFetch} from 'react-server-dom-esm'; // throws

// after
import {createFromFetch} from 'react-server-dom-esm/client';
Defensive patterns

Strategy: validation

Validate before calling

// ESLint blocks bare-specifier imports before they ship
// .eslintrc: "no-restricted-imports": ["error", { "paths": [{ "name": "react-server-dom-esm", "message": "Use react-server-dom-esm/client or /server" }] }]

Prevention

When it happens

Trigger: Importing the bare specifier: `import ... from 'react-server-dom-esm'` or `require('react-server-dom-esm')`; IDE auto-import picking the package root instead of the /client subpath; bundler or jest moduleNameMapper entries mapping the bare package name to its index.

Common situations: Auto-import completions in editors choosing the root entry; copy-pasted snippets that omitted the subpath; migration from react-server-dom-webpack where root-level imports of some helpers were possible.

Related errors


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