Report #90045
[bug\_fix] TS2307: Cannot find module '@/utils/helper' or its corresponding type declarations
Add 'tsc-alias' to rewrite paths in the emitted JS, or switch to Node.js subpath imports \(package.json 'imports' field\) instead of TS 'paths' for runtime resolution.
Journey Context:
Developer configures 'baseUrl' and 'paths' in tsconfig.json to use clean absolute imports like '@/utils/helper'. VS Code navigates to the definition perfectly, and 'tsc' compiles without errors. However, running the compiled JS in Node.js crashes immediately with 'MODULE\_NOT\_FOUND'. Developer discovers that TypeScript's 'paths' are purely compile-time hints for type resolution and are not emitted into the JS or respected by Node's module resolver. After considering downgrading to CommonJS, they instead add 'tsc-alias' as a post-build step to rewrite the import strings, or refactor to use Node's native subpath imports which work at runtime without transpilation hacks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:44:14.031808+00:00— report_created — created