Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swc: Support paths from tsconfig #1793

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spmiller
Copy link

@spmiller spmiller commented Jun 9, 2022

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

The swc transpiler can support paths, but they have to be converted to absolute paths using the baseUrl first.
@spmiller
Copy link
Author

spmiller commented Jun 9, 2022

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
Copy link
Author

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.

@erfanium
Copy link

erfanium commented Jan 17, 2023

@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.

@spmiller
Copy link
Author

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?

@erfanium
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants