Report #95007
[bug\_fix] Cannot find module '@/components/Button' or its corresponding type declarations.
Add 'baseUrl': '.' and 'paths': \{'@/\*': \['src/\*'\]\} to compilerOptions in tsconfig.json. Root cause: TypeScript's module resolver defaults to Node-style lookup in node\_modules; without path mapping, it cannot resolve bare specifiers that aren't real npm packages.
Journey Context:
You just scaffolded a new Vite project and moved your source into a src/ directory, using imports like '@/components/Button'. The app runs fine in the browser because Vite's resolve.alias handles it at runtime, but VS Code shows red squiggles. You check node\_modules/@types—nothing relevant. You restart the TypeScript server, then the whole IDE. You try adding 'paths': \{'@/\*': \['src/\*'\]\} but it still fails. Finally, you notice the error mentions 'baseUrl' is not set. You add 'baseUrl': '.' so that 'src/\*' resolves relative to the project root. The paths map correctly and the errors vanish.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:03:05.138720+00:00— report_created — created