facebook/react · error · Error

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

Error message

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

What it means

The package root of react-server-dom-webpack (index.js) is a deliberate dead end: its exports map routes './client' to browser/node client code and './server' to the react-server-only server code, leaving the bare root for the leftover case (typically Node require without the react-server condition). Importing the root always throws 'Use react-server-dom-webpack/client instead.' to push you to an explicit entry point.

Source

Thrown at packages/react-server-dom-webpack/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-webpack/client instead.');

View on GitHub (pinned to eafeac097b)

Solutions

  1. Client code: import from 'react-server-dom-webpack/client' (or /client.browser, /client.node, /client.edge)
  2. Server code: import from 'react-server-dom-webpack/server' or /static with Node running --conditions react-server
  3. Add an ESLint no-restricted-imports rule banning the bare package name so this is caught at lint time

Example fix

// before
import {createFromReadableStream} from 'react-server-dom-webpack';

// after
import {createFromReadableStream} from 'react-server-dom-webpack/client';
Defensive patterns

Strategy: validation

Validate before calling

// eslint: ban the bare import forever
// eslint.config.js
'no-restricted-imports': ['error', {
  paths: [{name: 'react-server-dom-webpack', message: 'Use react-server-dom-webpack/client or /server.'}],
}]

Prevention

When it happens

Trigger: require('react-server-dom-webpack') or import from 'react-server-dom-webpack' anywhere — the root entry exists only to reject this.

Common situations: Copy-pasting old examples that imported the package root before entries were split | Auto-import IDE completion choosing the package root | Shared isomorphic modules that try to import one path for both environments

Related errors


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