-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal.js coming in way of TreeShaking #54
Comments
Hmm, |
this pattern may be good for applications, which are not depended by others.. but libraries require tree shaking. is circular imports for Type coercion?
|
Yeah I was thinking to maybe only limit it to the affected files. It's the top four here: https://github.com/IIIF-Commons/manifesto/blob/master/src/internal.ts |
i.e leave the top four in internal, and remove the rest. The TS compiler will catch the import errors so it should just be a case of adding those back in. Also, index.ts will need to export them too. |
I tried to do that.. but tests doesn't passed if we just include only those four in internal.ts.. every time it shows an error for a new module circular import like Thumbnail, Collection, etc.. if i add one by one it is showing remaining in errors, effectively i have to add back most of them to internal.ts. so i restrained from PR. for size related matters, there is another issue opened #55 . |
@edsilv @damooo maybe wee need a couple of Types/Interfaces for those classes specifically, allow us to reference their properties without loading them in. I'm not sure exactly how this works, but you can do:
That way it won't actually bundle the module, instead just stripping out the types and ignoring it |
Hello guys,
Thanks for manifesto..
in latest commit, you created internal.ts as proxy for importing inside lib. now with this, bundlers like rollup cannot perform tree-shaking.
let's say we want to import only Canvas class into a project, without entire library, then as that imports exports from internal.js, and it inturn imports everything, then rollup bundles entire manifesto for one class. tree shaking is essential for smaller builds.
internal.js giving no other practical value than giving these inconviences and creating circular imports, etc.
The text was updated successfully, but these errors were encountered: