Report #5344
[bug\_fix] Cannot find module '@/components/Button' or its corresponding type declarations. ts\(2307\)
Configure \`baseUrl\` and \`paths\` in \`tsconfig.json\` to match the bundler's alias configuration, and ensure \`include\` covers the source directory.
Journey Context:
Developer sets up a Vite or Next.js project where the \`@/\` alias works at runtime but VS Code shows red squiggles and \`tsc\` fails. They spend an hour restarting the TypeScript server and checking for typos, assuming the bundler config is sufficient. They eventually realize that TypeScript's module resolution is independent of the bundler. They open \`tsconfig.json\`, set \`baseUrl: "."\`, add \`"paths": \{ "@/\*": \["src/\*"\] \}\`, and ensure \`include\` includes \`src/\*\*/\*\`. The error vanishes because TypeScript now has a explicit mapping to resolve the logical path to a physical file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:07:54.275724+00:00— report_created — created