facebook/react · error
Use react-server-dom-esm/client instead.
Error message
Use react-server-dom-esm/client instead.
What it means
The published npm artifact of react-server-dom-esm has the same root guard as the source package: npm/index.js exists only to throw and redirect imports to a subpath. This is the file actually resolved from node_modules when you import the bare package name, and it enforces the package's no-default-entrypoint design (client and server runtimes sit behind different export conditions).
Source
Thrown at packages/react-server-dom-esm/npm/index.js:12
/**
* 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
*/
'use strict';
throw new Error('Use react-server-dom-esm/client instead.');
View on GitHub (pinned to eafeac097b)
Solutions
- Use 'react-server-dom-esm/client' for client decoding APIs
- Use 'react-server-dom-esm/server' (with the react-server condition active) for the server
- Correct any moduleNameMapper/alias that maps the bare specifier to the package root
Example fix
// before
const {createFromNodeStream} = require('react-server-dom-esm'); // throws
// after
const {createFromNodeStream} = require('react-server-dom-esm/client'); Defensive patterns
Strategy: validation
Validate before calling
// jest moduleNameMapper so the bare name never resolves to the guard file
// jest.config.js
module.exports = {
moduleNameMapper: {
'^react-server-dom-esm$': 'react-server-dom-esm/client',
'^react-server-dom-esm/server$': 'react-server-dom-esm/npm/server.react-server.js',
},
}; Prevention
- Import subpaths only (client/server), never the package root
- Fix bundler aliases and jest moduleNameMapper that map the bare specifier
- Reject auto-generated imports of the root entry in code review or via lint rule
When it happens
Trigger: `import X from 'react-server-dom-esm'` or `require('react-server-dom-esm')` resolving to node_modules/react-server-dom-esm/index.js; test configs or bundler aliases mapping the bare name; tooling that walks a package's exports and accidentally executes the root entry.
Common situations: Editor auto-import choosing the root; jest moduleNameMapper shorthand like '^react-server-dom-esm$': 'react-server-dom-esm'; code migrated from another RSC transport package.
Related errors
- Use react-server-dom-esm/client instead.
- Use react-server-dom-turbopack/client instead.
- Use react-server-dom-unbundled/client instead.
- react-dom/client is not supported in React Server Components
- react-dom/profiling is not supported in React Server Compone
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/7b3a8c568050336f.
Report an issue: GitHub.