Report #76046
[bug\_fix] Path mapping '@app/\*' works in IDE but fails at runtime with 'Error: Cannot find module '@app/components''
Install \`tsconfig-paths\` and preload it via \`node -r tsconfig-paths/register\`, or use \`tsc-alias\` to rewrite imports post-build, or configure your bundler \(Vite/Webpack\) to resolve the aliases during build.
Journey Context:
Developer configures \`compilerOptions.paths\` in tsconfig.json to map \`@app/\*\` to \`./src/\*\`. VS Code Intellisense works perfectly, imports resolve, and \`tsc\` compiles without errors. However, running \`node dist/index.js\` immediately crashes with 'Cannot find module'. The developer tries adding \`baseUrl\`, changing the path patterns, and even installing \`@types/node\` to no avail. They realize TypeScript only uses paths for type-checking and compile-time resolution but emits the original import specifiers unchanged. Node.js has no knowledge of these aliases, causing the runtime failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:14:13.816693+00:00— report_created — created