dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

transformers support

rifler opened this issue · comments

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.