{"record":{"id":"f3fa890064eaae65","repo":"facebook/react","slug":"react-dom-profiling-is-not-supported-in-react-serv","errorCode":null,"errorMessage":"react-dom/profiling is not supported in React Server Components.","messagePattern":"react-dom/profiling is not supported in React Server Components\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-dom/npm/profiling.react-server.js","lineNumber":3,"sourceCode":"'use strict';\n\nthrow new Error(\n  'react-dom/profiling is not supported in React Server Components.'\n);\n","sourceCodeStart":1,"sourceCodeEnd":6,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-dom/npm/profiling.react-server.js#L1-L6","documentation":"react-dom/profiling is a browser-only build of react-dom that adds performance profiling instrumentation. Under the react-server export condition the package resolves to a stub whose entire module body is a single throw, because profiling hooks are meaningless in a Server Components bundle that never runs client rendering code. Any import of it inside a React Server Components module graph fails at import time, before any application code runs.","triggerScenarios":"Any import of 'react-dom/profiling' (direct, or transitively via a shared utility or component library) from a file evaluated under the react-server condition: a Server Component in Next.js App Router, a *.server.js file, or a bundler/Jest config that applies resolve.conditions ['react-server'] too broadly.","commonSituations":"A component library that imports react-dom/profiling in its published entry gets pulled into a Server Component; Jest moduleNameMapper aliasing react-dom to the profiling build for all environments including server tests; migrating shared modules to RSC while keeping old profiling imports.","solutions":["Add \"use client\" to (or move the profiling import into) a client-only module so the server graph never evaluates it","Load it lazily from the browser only, e.g. a dynamic import inside useEffect, so the react-server graph never sees the specifier","Fix bundler/Jest config so the react-server condition applies only to files compiled for the server-components graph","Gate the import behind a runtime environment check and skip it on the server"],"exampleFix":"// before (shared/utils.js — also imported by a Server Component)\nimport 'react-dom/profiling';\n\n// after (ProfilingClient.js)\n'use client';\nimport 'react-dom/profiling';\nexport default function ProfilingClient() { /* ... */ }","handlingStrategy":"try-catch","validationCode":"// profiling is client-only; never let the server graph see the specifier\nconst isBrowser = typeof window !== 'undefined';\nif (isBrowser) {\n  const profiling = await import('react-dom/profiling');\n}","typeGuard":null,"tryCatchPattern":"let profilingApi = null;\nif (typeof window !== 'undefined') {\n  try {\n    profilingApi = await import('react-dom/profiling');\n  } catch (e) {\n    console.error('react-dom/profiling unavailable in this bundle', e);\n  }\n}","preventionTips":["Keep every react-dom/profiling import inside modules marked \"use client\"","Scope react-server resolve conditions to server-components directories only","Audit component-library entry points for react-dom subpath imports before using them in RSC apps"],"tags":["react-server-components","react-dom","profiling","import-time-error","module-resolution"],"backgroundTag":"unsupported-import-in-rsc","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}