Report #63100
[bug\_fix] Cannot find module '@app/utils' or its corresponding type declarations.
Add 'baseUrl': '.' and 'paths': \{'@app/\*': \['src/\*'\]\} to tsconfig.json compilerOptions, then restart the TypeScript server. Root cause: TypeScript's module resolution strategy \(Node or Classic\) only resolves relative paths or node\_modules; it requires explicit path mapping to resolve custom alias prefixes to physical directories.
Journey Context:
You just refactored your monorepo to use path aliases like \`@app/utils\` instead of \`../../../utils\`. The runtime works because your bundler \(Vite/Webpack\) resolves them, but VS Code immediately underlines the import in red with 'Cannot find module'. You first check if you saved \`tsconfig.json\` — you did. You try restarting the TS server via command palette, nothing. You check if \`baseUrl\` is set, realizing that \`paths\` are resolved relative to \`baseUrl\`, which defaults to the location of \`tsconfig.json\`, but you need it relative to the project root. You set \`"baseUrl": "."\` and \`"paths": \{ "@app/\*": \["src/app/\*"\] \}\`, restart the TS server, and the red squiggles vanish. The fix works because TypeScript's module resolution algorithm specifically looks up the \`paths\` mapping before attempting node\_modules resolution, but only when the compilerOptions are correctly scoped with baseUrl.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T12:23:36.507475+00:00— report_created — created