Report #73605
[bug\_fix] File '@scope/shared-config/base.json' not found when extending tsconfig from an npm package subpath.
In the shared config package's \`package.json\`, add an \`exports\` field that explicitly maps the subpath to the file: \`"exports": \{ "./base.json": "./base.json" \}\`. Alternatively, rename the config to \`tsconfig.json\` at the package root so TypeScript resolves it via the package name alone without subpaths. Root cause: When \`extends\` uses a non-relative specifier \(package name\), TypeScript 5.0\+ resolves it as a package reference. For subpaths \(e.g., \`@scope/config/base\`\), TypeScript relies on Node.js package resolution rules, which require the subpath to be explicitly exported in the package's \`exports\` field \(or exist as a physical file without exports field if not using exports at all, but modern packages often define exports\). Without the export, the file is inaccessible to the external package resolution algorithm.
Journey Context:
You are standardizing TypeScript configurations across a monorepo. You create a package \`@acme/tsconfig\` containing \`base.json\`, \`react.json\`, etc. In an app, you write \`"extends": "@acme/tsconfig/base.json"\`. TypeScript fails with 'File @acme/tsconfig/base.json not found'. You check \`node\_modules/@acme/tsconfig/base.json\` and it exists. You try \`"extends": "./node\_modules/@acme/tsconfig/base.json"\` and it works, but breaks if the hoisting changes. You research and find that TypeScript 3.2\+ allows extending from \`node\_modules\`, but for subpaths, it follows Node.js module resolution. You check the \`@acme/tsconfig/package.json\` and see it has an \`exports\` field that only defines \`"./package.json": "./package.json"\` but not the json configs. You add \`"exports": \{ "./\*": "./\*" \}\` or specifically \`"./base.json": "./base.json"\` to the shared package's \`package.json\`. After reinstalling the dependency to refresh the link, TypeScript successfully resolves \`@acme/tsconfig/base.json\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:08:30.689253+00:00— report_created — created