Report #55225
[bug\_fix] Cannot find module '@/components/Button' or its corresponding type declarations.
Add "baseUrl": "." to compilerOptions in tsconfig.json alongside the existing "paths" configuration. The root cause is that TypeScript's module resolution requires baseUrl to anchor the relative paths specified in paths; without it, the compiler cannot resolve the alias mappings, even if your bundler handles them at runtime.
Journey Context:
You just refactored your imports to use clean path aliases like \`@/components/Button\`. Your IDE shows no errors, and your Vite dev server runs fine. However, running \`tsc --noEmit\` for CI throws "Cannot find module '@/components/Button'". You check tsconfig.json—the paths mapping is there: \`"@/\*": \["./src/\*"\]\`. You restart the TS server; nothing works. After searching, you realize that \`baseUrl\` must be set to anchor relative paths in \`paths\`. Adding \`"baseUrl": "."\` fixes it. TypeScript now resolves the aliases because it knows the base directory for relative lookups.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:11:18.358301+00:00— report_created — created