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

transformers support #219

Open
rifler opened this issue Aug 4, 2022 · 1 comment · May be fixed by #273
Open

transformers support #219

rifler opened this issue Aug 4, 2022 · 1 comment · May be fixed by #273

Comments

@rifler
Copy link

rifler commented Aug 4, 2022

Hello!

As you probably know, TypeScript has Compiler API, which allows to create "transformers" - functions in which you get control over AST and change it as you wish.
Unfortunately, to use this transformers you should completely duplicate the whole tsc command yourself. It is inconvenient.
Feature request to implement support for transformers right into tsconfig.json - microsoft/TypeScript#14419

Fortunately, there are some solutions, which patch tsc command and make it to respect transformers defined it tsconfig.json. So they are executed at build time. I guess the most popular tool is ttypescript.

Also, there are several packages quite similar to tsconfig-paths, which provides ttypescript support for build-time paths transformations, for instance:
https://github.com/OniVe/ts-transform-paths
https://github.com/zerkalica/zerollup/tree/master/packages/ts-transform-paths
https://github.com/LeDDGroup/typescript-transform-paths

But they are not so popular, tested and maintained as tsconfig-paths.

I suppose it would be great to export ready transformer from tsconfig-paths. This would allow to dramatically cut off entropy and produce path's transformations during build time.

@Farenheith Farenheith linked a pull request Sep 24, 2024 that will close this issue
@Farenheith
Copy link

Farenheith commented Sep 24, 2024

I created a plugin for it and tested it with jest. It worked as expected. Can you try it on too?

#273

I also created this package to be used while the PR is not approved: https://www.npmjs.com/package/tsconfig-paths-hook

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 a pull request may close this issue.

2 participants