ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

swc: Support paths from tsconfig

Open spmiller opened this issue 3 years ago • 5 comments

The swc transpiler can support paths, but they have to be converted to absolute paths using the baseUrl first.

spmiller avatar Jun 09 '22 05:06 spmiller

Hi maintainers, some more context in case it's not clear: tsconfig.json supports paths, but this wasn't wired into the ts-node swc transpiler. I wired this in using absolute paths (as recommended here)

spmiller avatar Jun 09 '22 05:06 spmiller

Hi @cspotcode, I see you're also working on swc support in #1802. Assuming you see the value in this PR, how do think it should progress? I'm happy to help out if you would like it to go in as part of #1802.

spmiller avatar Jun 19 '22 21:06 spmiller

@spmiller I came across this today. but here's a thing. we should not add a feature that is only available on swc. I think this feature is not supported by TypeScript official transpiler.

erfanium avatar Jan 17 '23 21:01 erfanium

Hi @erfanium, thanks for looking at this patch.

The paths attribute is indeed supported by tsc (I linked to the config above) but ts-node wasn't passing this part of the config through to the swc compiler. Because of this, I don't think it's only available on swc, but perhaps I have misunderstood your point?

spmiller avatar Jan 18 '23 02:01 spmiller

@spmiller I have made a tiny repo for you: https://github.com/erfanium/esm-ts-paths

in tsconfig file, either using swc: true to swc: false doesn't make it work. that means this feature is not supported by tsc even.

or maybe i am wrong

erfanium avatar Jan 21 '23 22:01 erfanium