feature request: TS paths support
temeke opened this issue ยท 5 comments
Thanks for the tool ๐๐ผ I noticed that this library does not support typescript path variables. Support for those would be a nice feature. Thank you!
Hi @temeke, can you provide an example of a path alias configuration in your tsconfig.json
file and how you use such a path in your source code?
{ "compilerOptions": { ... "paths": { "@database/*": ["apps/database/*"], } }, "ts-node": { "require": ["tsconfig-paths/register"] } }
And how I'm using the path
import { item } from '@database/src/item'
I think the ts2esm should convert the path to
import { item } from '@database/src/item.js'
Now I added the .js manually to all imports that used the @database.
Thanks for the info @temeke! ts-morph
supports project.getCompilerOptions().paths
which should return the paths resolution and therefor make it very easy to implement support for it in ts2esm
.
I created an example repo (with CommonJS module syntax & TS Path aliases): https://github.com/bennycode/ts-demo-npm-cjs/
I also started working on implementing the paths support: #53