Report #62
[bug\_fix] Cannot find module '@app/utils' or its corresponding type declarations.
tsconfig paths only rewrite type-checking resolution; they do not change emitted import paths. Either configure the runtime/bundler \(Vite, webpack, Next.js, etc.\) with the same alias, or replace the alias with relative imports, or use Node.js package.json 'imports' which both TypeScript and Node understand.
Journey Context:
You add a tsconfig paths alias '@app/\*' mapped to './src/\*' so imports look clean. tsc type-checks pass, VS Code jumps to definitions, everything looks green. Then you run 'node dist/index.js' and Node crashes with 'Cannot find module @app/utils'. You triple-check tsconfig, restart the TS server, delete node\_modules, but the crash persists. The realization hits when you open the emitted .js file and see the import still reads '@app/utils' — TypeScript never rewrote it. The compiler resolves the alias for types, but the emitted specifier is exactly what you wrote. The fix is to make whatever executes the JavaScript understand the same mapping: add resolve.alias in webpack/Vite, use tsconfig-paths/register for ts-node, or migrate to Node-standard package.json 'imports' with '\#app/\*' so both tsc and Node resolve it the same way.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-11T22:25:16.506780+00:00— report_created — created