gillchristian / io-ts-reporters

Error reporters for io-ts
https://gillchristian.github.io/io-ts-reporters
MIT License
90 stars 17 forks source link

Large bundle size #30

Open osdiab opened 4 years ago

osdiab commented 4 years ago

When using my fork or io-ts-reporters which is just tracking master, the bundle size is much larger than it ought to be. This showed up on the project I am using it on.

https://bundlephobia.com/result?p=@osdiab/io-ts-reporters@1.1.1

This library can potentially make use of tree shaking or something to avoid bundling the entirety of io-ts and fp-ts with it. Maybe:

gillchristian commented 4 years ago

We should definitely look into that. Probably we could implement all of your suggestions and get some good results.

https://bundlephobia.com/result?p=io-ts-reporters@1.1.0

gillchristian commented 4 years ago

@osdiab I updated your comment making it a checklist and and marked some as done as per #34

UPDATE: it seems like that alone made a huge difference

osdiab commented 4 years ago

@OliverJAsh I saw your issue here: https://github.com/gcanti/fp-ts/issues/1044

It seems all the imports in this library are also /lib/* imports when /es6/* imports would also allow tree shaking of those libraries (as of now this library still pulls in a lot of data when analyzing my bundle size on the side of my app). Perhaps we can emulate how gcanti achieves the separate es6 and lib bundles here too

osdiab commented 4 years ago

This was recently merged into fp-ts: https://github.com/gcanti/fp-ts/pull/1241

osdiab commented 3 years ago

just realized as well that this uses a lot of fp-ts utilities - with just io-ts it only uses fp-ts/Either and fp-ts/pipeable which results in about 10kb from that library before compression, but with io-ts-reporters I'm getting about 50kb extra from all the fp-ts stuff this uses - surprising to me!