Typescript add import with compiler API

30 views Asked by At

I am trying to use the typescript compiler API to add to transpiled code some imports. The idea is:

This is before:

// index.ts
export * from './user.repository'

After transpiled:

//index.ts
import './save.user.repository.extension'
import './delete.user.repository.extension'
export * from './user.repository'

I try to use ts.createPrinter but the result file not contains the imports. How I can append the imports to the file in compile time?

0

There are 0 answers