-
Notifications
You must be signed in to change notification settings - Fork 20
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
Discussion about bundle size #46
Comments
Hey @NicolasCARPi thanks for reaching out. Yeah the bundle size is something that has been on my radar for a long time but hasn't been prioritized given that our app is quite enterprise-y and a slightly larger payload is ok. I think removing the ubuntu font seems like a good idea, I didn't realize that it added so much weight. I'll remove that now. I'm not sure about other low hanging fruits... here's a quick visualization of the project using
![]() ![]() Interactive page download available here - Vite Bundle Visualizer.html.zip There are some things that are probably duplicate functionality. I think the bigger win would be to restructure the code in a way that makes it more tree shakeable somehow. |
…ntu-mono font style to get a smaller bundle size - #46
Great!
Yes, that's definitely something to look at. I'm guessing vite does three shaking by default. I found something: for lodash, if you can manage to remove all the If you make sure to "import someSpecificModule from ..." everytime and avoid importing a whole lib, it should work in the good direction. Cheers, |
Hey @NicolasCARPi , I published new versions of ui/ove that remove any
Unfortunately those changes don't appear to make the lodash import any smaller according to |
Great, I can see the change in CSS file size which is huge, so that's already a positive result. Indeed it looks like the lodash stuff isn't enough. It might be worth exploring using instead lodash-es: https://stackoverflow.com/questions/67084600/how-to-config-lodash-tree-shaking-in-vite The README of lodash contains:
And we are looking for smaller bundle sizes! :D |
Hello @tnrich , Did you have the chance to look into using Best, |
Hey @NicolasCARPi I tried to swap out lodash for lodash-es and ran into this error.
This isn't very high priority for me right now so am not going to spend a lot of time trying to get it to work. Happy to take a PR if you get it working. Thanks! |
Ok thanks for trying. It might indeed require more time to figure it out properly. I understand that this is not a priority for you and will come back with a PR if I manage to work it out. Cheers, |
Hi @NicolasCARPi unfortunately we've noticed regressions caused by the removal of the Ubuntu Mono typeface. I'll need to revert that change to how it was. I'm not sure why that typeface would increase the bundle size as much as it does.. Seems like it ought to be smaller. I can continue to investigate how to make that smaller but the editor label sizing logic was built around the size of the ubuntu mono font so changing it out for another is causing issues: |
Hello, I see. Reverting to using Ubuntu is an understandable solution to an immediate problem. It's a pity for bundle size, but c'est la vie ! After, there will be a need to look into the actual issue at play here: improper text flow management. I'd argue that an UI should not be dependant on typeface or text size or anything like that. Of course, it's easy for me to say this, and I fully understand technical hurdles leading to decisions such as sticking to a particular font. Still, it would very much be the better fix in the long run. Thank you for your consideration and have a nice week-end! |
Hi @NicolasCARPi agreed! Unfortunately there might be quite a bit of digging in the weeds necessary to get that ideal solution to work. Have a good weekend yourself. Thanks for being understanding! |
Hello @tnrich and others,
Your
ove
package is used in eLabFTW, and we're very happy with it from a developer point of view, but also from a user perspective. It's a great tool!We recently were able to ditch our repackaging repo and use the upstream npm package directly. It's great to see the app being maintained and improved over time (long term maintenance is a huge problem in OSS).
But I have a (small) problem. You see,
ove
package results in a lot of megabytes of JS and CSS (8.9 Mb) for me. But eLabFTW uses other libraries, too, and this adds up and adds up and you end up with a 18 Mb website... Which is something I'd like to work on.A few points:
ove
. An app already using these won't pay the same penalty. Clearly, the dependencies you have (and that I have not) are the main issue here rather than the ove specific code.I'd like to discuss with you possible paths for working towards improving the bundle size.
For instance, do you think it would be possible to remove the requirement for Ubuntu font? The woff files end up base64'd in the
style.css
which is 2.1 Mb. Removing the Ubuntu font from that file reduces it to 1.2 Mb. Which is still a lot of styles but it is a quick win with big payout. You could declare it as optional dependency.Hope you have other leads. I'm not going to suggest switching from blueprint/react to vanilla JS, that would be silly 😛 But maybe there are other low hanging fruits out there! ;)
BTW, I would be happy to sponsor this through Deltablot.
With best regards,
~Nicolas
The text was updated successfully, but these errors were encountered: