-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Significantly smaller bundles #850
Conversation
Pull Request Test Coverage Report for Build 765
💛 - Coveralls |
Hi @fabiospampinato, I'm the maintainer of Day.js that you mentioned above. If there's any I can do to help the optimization or upgrade Day.js accordingly, feel free to contact me. |
@iamkun thanks! I'm not 100% sure about why replacing @knsv I think I may actually use this webpack plugin to squeeze some more bytes out of the bundles, turns out that across all our dependencies only the following lodash functions being used:
So I guess there is still a significant room for improvement bundle-size-wise. |
Actually using |
Thanks Fabio. Will take alook at this and merge this weekend. |
Is it still possible to include/set a locale after this change? |
Hey @knsv, I've just implemented some changes previously discussed aimed at reducing mermaid's bundled size, which is currently pretty significant.
I've replaced
moment
withmoment-mini
, which got rid of all the useless locale files. I'd like to switch todayjs
entirely, but currentlymoment
is used to parse some relative date formats like2d
, I'm not sure if that's really useful or not though.I've removed the
src
folder from the allowed paths being published to NPM.I had first reimplemented some basic lodash methods in vanilla JS and then imported only the specific non trivial ones, which reduced the bundle size, but then I noticed that another version of lodash was getting loaded by other dependencies, so later I aligned the versions so that only 1 copy of lodash get loaded (I guess this wasn't happening before because of the lock file).
The unminified bundle size went from ~4.5MB to ~2.3MB, while the minified bundle size went from ~1.4MB to ~800KB. IMHO that's a pretty significant improvement. It could be much smaller if the other libraries in our dependency tree stopped requiring the entirety of lodash, I've opened a few issues about that in their repos, let's see.
Let me know if you need any modification.
Closes #843