Report #27217
[bug\_fix] Cannot find module '@org/shared' or its corresponding type declarations.
Set 'baseUrl': '.' and 'paths': \{'@org/\*': \['packages/\*/src'\]\} in tsconfig.json, ensuring the mapped directories are included in the 'include' array. For monorepos, verify that 'references' are configured with 'composite': true in the dependency packages.
Journey Context:
Developer clones a monorepo with packages in \`/packages/shared\` and \`/apps/web\`. They try to import \`import \{ utils \} from '@org/shared'\` in the web app. VS Code immediately underlines the import with TS2307. The developer checks that a bundler \(Vite\) resolves the alias correctly at runtime, so the code executes, but TypeScript complains during \`tsc --noEmit\`. They examine \`tsconfig.json\` and see \`baseUrl: './src'\`, but the paths mapping is relative to \`baseUrl\`, so \`../packages/shared/src\` doesn't resolve correctly. They try changing \`baseUrl\` to \`.\` and updating \`paths\` to \`@org/\*\`: \`packages/\*/src\`, but the error persists. After hours of searching, they realize the \`include\` array in \`tsconfig.json\` only included \`src/\*\*/\*\`, so the files in \`packages/shared/src\` were not part of the compilation context at all, even though the paths were mapped. The fix required both correcting the \`paths\` relative to the new \`baseUrl\` and adding \`../../packages/\*/src\` to the \`include\` pattern \(or using project references\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:04:53.933332+00:00— report_created — created