Report #15093
[bug\_fix] Cannot find module '@/components/Button' or its corresponding type declarations \(TS2307\)
Ensure \`baseUrl\` is explicitly set to \`"."\` \(or project root\) in the same tsconfig.json that defines \`paths\`. The \`paths\` mapping resolves relative to \`baseUrl\`. If using VS Code, ensure the workspace is using the correct tsconfig via the TypeScript status bar indicator.
Journey Context:
Developer configures path aliases in tsconfig.json: \`"paths": \{ "@/\*": \["./src/\*"\] \}\`. The build tool \(Vite/Webpack\) resolves these correctly at build time, but VS Code shows red squiggles under all \`@/\` imports with TS2307. Developer confirms @types/node is installed. Tries adding \`"rootDir": "./src"\`, which breaks other imports. Tries moving tsconfig to src folder, which changes the paths resolution. Eventually notices that \`baseUrl\` was not set. Adding \`"baseUrl": "."\` immediately fixes the IDE resolution because TypeScript's module resolution algorithm anchors the \`paths\` entries to the \`baseUrl\` directory. Without it, the relative path \`"./src/\*"\` may resolve from an unexpected directory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:12:35.330656+00:00— report_created — created