{"record":{"id":"5667c80306239141","repo":"facebook/react","slug":"this-module-must-be-shimmed-by-a-specific-renderer-5667c8","errorCode":null,"errorMessage":"This module must be shimmed by a specific renderer.","messagePattern":"This module must be shimmed by a specific renderer\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/react-reconciler/src/ReactFiberConfig.js","lineNumber":20,"sourceCode":" * 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\n/* eslint-disable react-internal/prod-error-codes */\n\n// We expect that our Rollup, Jest, and Flow configurations\n// always shim this module with the corresponding host config\n// (either provided by a renderer, or a generic shim for npm).\n//\n// We should never resolve to this file, but it exists to make\n// sure that if we *do* accidentally break the configuration,\n// the failure isn't silent.\n\nthrow new Error('This module must be shimmed by a specific renderer.');\n","sourceCodeStart":2,"sourceCodeEnd":21,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-reconciler/src/ReactFiberConfig.js#L2-L21","documentation":"packages/react-reconciler/src/ReactFiberConfig.js is a deliberate trap: react-reconciler never ships with a real host config. Rollup aliases and Jest moduleNameMapper are supposed to replace this module with a renderer's host config (e.g. react-dom's ReactDOMHostConfig). If module resolution ever loads this stub, it throws immediately at import time so a broken build config fails loudly instead of silently.","triggerScenarios":"Importing react-reconciler source directly in Jest, webpack, or any bundler without the alias mapping 'ReactFiberConfig' to a host config; a fork or monorepo where the jest moduleNameMapper / rollup alias entries were dropped or path-mismatched.","commonSituations":"Contributing to React or building a custom renderer fork and the test/bundle config lost the shim aliases; tooling (ts-jest, esbuild) that ignores moduleNameMapper; deep imports that bypass the configured entry points.","solutions":["Consume the published npm build of react-reconciler (it ships with a bundled config) instead of source.","For Jest, add moduleNameMapper entries mapping 'react-reconciler' (and the config path) to your host config file, mirroring React's own jest.config.js.","For bundlers, add the equivalent resolve.alias so ReactFiberConfig resolves to your host config."],"exampleFix":"// before: jest.config.js with no mapping -> tests crash with 'must be shimmed'\nmodule.exports = {testEnvironment: 'node'};\n\n// after: map reconciler config to your host config\nmodule.exports = {\n  testEnvironment: 'node',\n  moduleNameMapper: {\n    '^react-reconciler$': '<rootDir>/src/ReactFiberReconciler.js',\n    'ReactFiberConfig': '<rootDir>/hostconfig/myHostConfig.js',\n  },\n};","handlingStrategy":"validation","validationCode":"// Assert the trap module never resolves in your build/test setup\nconst assert = require('assert');\nconst path = require('path');\nconst resolved = require.resolve('react-reconciler');\nassert(!resolved.includes(path.join('src', 'ReactFiberConfig.js')),\n  'ReactFiberConfig trap resolved — fix your moduleNameMapper/aliases');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy React's jest moduleNameMapper entries when testing reconciler source","Prefer published react-reconciler builds which bundle a host config","CI smoke test that imports react-reconciler once, so alias breakage fails the build"],"tags":["build-config","jest","bundler","module-resolution","react-internal"],"backgroundTag":"bundler-module-alias-misconfigured","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}