Hookyns / tst-reflect

Advanced TypeScript runtime reflection system
MIT License
338 stars 11 forks source link

`import * as _Br from 'tst-reflect'` is added to every compiled file #65

Closed avin-kavish closed 2 years ago

avin-kavish commented 2 years ago

and not just the ones that use it

avin-kavish commented 2 years ago

This is actually problem for front-end code, affects bundle size.

Hookyns commented 2 years ago

This is added to each root/entry file. If you configure your tsconfig like include: "**/*.ts", all the matched files are meant as root files. Each of that file can be root/entry file. So it is important to add that to each such file.

If you change the include to "index.ts", TS knows this is only root/entry file, and it will follow imports to find all other application files.

I can add new option to config: rootFiles: string[].

avin-kavish commented 2 years ago

So it is important to add that to each such file.

why? The library is only needed when used

Hookyns commented 2 years ago

Fixed in v1. Not in the current version.