Skip to content
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

Large bundle size #30

Open
2 of 4 tasks
osdiab opened this issue Jun 10, 2020 · 5 comments
Open
2 of 4 tasks

Large bundle size #30

osdiab opened this issue Jun 10, 2020 · 5 comments
Milestone

Comments

@osdiab
Copy link
Contributor

osdiab commented Jun 10, 2020

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/[email protected]

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:

  • sideEffects: false in package.json
  • ESModules as an output option
  • maybe a bundler like Rollup can help
  • would having those as peer dependencies be a good idea?
@gillchristian
Copy link
Owner

gillchristian commented Jun 10, 2020

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

https://bundlephobia.com/[email protected]

@gillchristian
Copy link
Owner

gillchristian commented Jun 25, 2020

@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

  • v1.1.0: 75.5kB Minified / 16.1kB Minified + Gzipped

  • v1.2.0: 2.4kB Minified / 923B Minified + Gzipped

@osdiab
Copy link
Contributor Author

osdiab commented Aug 7, 2020

@OliverJAsh I saw your issue here: gcanti/fp-ts#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
Copy link
Contributor Author

osdiab commented Aug 7, 2020

This was recently merged into fp-ts: gcanti/fp-ts#1241

@osdiab
Copy link
Contributor Author

osdiab commented Sep 13, 2020

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!

@osdiab osdiab closed this as completed Sep 13, 2020
@osdiab osdiab reopened this Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants