Closed kevinresol closed 6 days ago
One of my use cases for genes is (eventually) publishing some generated js code. To have the best interop (and ease documentation) having the same structure is quite useful.
Your scenario I think is actually more of a limitation of javascript tree shaking. If the bundler was "smarter" it should be able to split these (but none do, I tested some similar things).
But, the way things currently work, it shouldn't be too hard to add a flag to force every type to get their own module, which would allow your use case too.
Another option is to produce a warning if you're using dynamicImport but a type from the same module is imported outside of the callback.
Information like that would be useful too :+1:
The above code will not enjoy code splitting because of the generated static import for sub-type
Bar
:Could this be improved by generating sub-types into separate files too? Are there any implications?