{"id":"a3b224e1d4c1c2f2","repo":"jestjs/jest","slug":"jest-loader-is-required-for-the-typescript-c","errorCode":null,"errorMessage":"Jest: '${loader}' is required for the TypeScript configuration files. Make sure it is installed\nError: ${error.message}","messagePattern":"Jest: '(.+?)' is required for the TypeScript configuration files\\. Make sure it is installed\nError: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-config/src/readConfigFileAndSetRootDir.ts","lineNumber":239,"sourceCode":"              target: `node${process.version.slice(1)}`,\n              ...extraTSLoaderOptions,\n            });\n          } else {\n            instance?.unregister();\n          }\n        },\n      };\n    }\n\n    throw new Error(\n      `Jest: '${loader}' is not a valid TypeScript configuration loader.`,\n    );\n  } catch (error) {\n    if (\n      isError(error) &&\n      (error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND'\n    ) {\n      throw new Error(\n        `Jest: '${loader}' is required for the TypeScript configuration files. Make sure it is installed\\nError: ${error.message}`,\n        {cause: error},\n      );\n    }\n\n    throw error;\n  }\n}\n","sourceCodeStart":221,"sourceCodeEnd":248,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L221-L248","documentation":"registerTsLoader tries to dynamically import the named loader module. If that import fails with ERR_MODULE_NOT_FOUND (the package is not installed), Jest rethrows with guidance naming the loader and instructing installation. This is distinct from error [66] which rejects unknown loader names entirely.","triggerScenarios":"Configuring `@jest-config-loader esbuild-register` in the docblock without adding esbuild-register to devDependencies, or naming ts-node without installing it.","commonSituations":"New teammate cloning a repo whose docblock references a loader not in package.json; switching loaders without updating installs; CI caching that skips optional deps.","solutions":["Install the missing loader: `npm i -D ts-node` or `npm i -D esbuild-register`","Ensure the loader is in devDependencies, not only a transitive dependency of another package","Clear CI cache / reinstall node_modules if the package is listed but missing"],"exampleFix":"// before: docblock references esbuild-register, package not installed\n/**\n * @jest-config-loader esbuild-register\n */\n// after\nnpm install -D esbuild-register","handlingStrategy":"validation","validationCode":"async function loaderIsInstalled(loader: string): Promise<boolean> {\n  try { await import(loader); return true; } catch { return false; }\n}\nif (!(await loaderIsInstalled('ts-node'))) {\n  throw new Error('ts-node is not installed');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the docblock loader and devDependencies in sync","Add a CI check that verifies the configured loader resolves"],"tags":["typescript","config","loader","dependencies"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}