{"record":{"id":"e8dcd8481a22242e","repo":"facebook/react","slug":"use-react-server-dom-esm-client-instead","errorCode":null,"errorMessage":"Use react-server-dom-esm/client instead.","messagePattern":"Use react-server-dom-esm/client instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/react-server-dom-esm/index.js","lineNumber":10,"sourceCode":"/**\n * 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\nthrow new Error('Use react-server-dom-esm/client instead.');\n","sourceCodeStart":1,"sourceCodeEnd":11,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-esm/index.js#L1-L11","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Import the RSC client from 'react-server-dom-esm/client' (createFromFetch, createFromReadableStream, createFromNodeStream)","Import server-side APIs from 'react-server-dom-esm/server' and run under the react-server condition","Fix bundler/jest aliases so the bare specifier never resolves to the guard file"],"exampleFix":"// before\nimport {createFromFetch} from 'react-server-dom-esm'; // throws\n\n// after\nimport {createFromFetch} from 'react-server-dom-esm/client';","handlingStrategy":"validation","validationCode":"// ESLint blocks bare-specifier imports before they ship\n// .eslintrc: \"no-restricted-imports\": [\"error\", { \"paths\": [{ \"name\": \"react-server-dom-esm\", \"message\": \"Use react-server-dom-esm/client or /server\" }] }]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always import a subpath: react-server-dom-esm/client or react-server-dom-esm/server","Add an eslint no-restricted-imports rule for the bare specifier","Watch for IDE auto-imports that pick the package root"],"tags":["react-server-components","entrypoint","api-misuse","esm"],"backgroundTag":"package-entrypoint-guard","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}