TypeScript Transformers: Transform imported file

Viewed 146

Is there a way for a TypeScript transformer to modify an imported file that is not a "SourceFile"?

For example in this repl: https://repl.it/@AndrewLeedham56/rollup-plugin-ts-external-repro#transformer.js (using @wessberg/rollup-plugin-ts) I am trying to add a React like import to each file, but Child.tsx is treated as external so they are not included in the outputted bundle. The problem here is that my visitor is only traversing SourceFile's and Child.tsx is not a SourceFile. So I am wondering if there is a way to traverse and modify imported files?

Any insight would be greatly appreciated, Thanks.

0 Answers
Related