justkey007 / tsc-alias

Replace alias paths with relative paths after typescript compilation
MIT License
876 stars 63 forks source link

tsc-alias does not properly replace aliases in declaration files when using a build with emitDeclarationOnly #196

Open stof opened 1 year ago

stof commented 1 year ago

All replacements get reported as Invalid path in the debug output.

I suspect that the resolver tries to check the existence of the target file. When replacing in a declaration file, it would be great if the check could accept a case where we only have a declaration file for the target file (even if the file does not exist).

stof commented 1 year ago

this happens when the aliases in the tsconfig.json file look like "display-svg": ["./src/dispay/svg.js"]. If I remove the .js extension from the alias, the path is accepted as valid.