Report #60796
[bug\_fix] Cannot find module '@app/utils' or its corresponding type declarations.
Set "baseUrl": "." in tsconfig.json compilerOptions alongside the "paths" mapping. Ensure the paths are relative to this baseUrl and that source files are included via the "include" array.
Journey Context:
The developer configures path aliases in tsconfig.json, such as "@app/\*": \["src/app/\*"\], and VS Code IntelliSense resolves imports perfectly. However, running tsc fails with "Cannot find module '@app/utils'". The developer verifies the paths are correct, checks for typos, and examines the module resolution trace with tsc --traceResolution. They discover that without an explicit baseUrl, the TypeScript compiler resolves path mappings relative to an unspecified root, causing resolution to fail even when the IDE \(which uses its own resolution logic\) succeeds. Adding "baseUrl": "." anchors the paths to the directory containing tsconfig.json, aligning the compiler's resolution strategy with the project structure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:31:52.629645+00:00— report_created — created