-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Smaller bundles #843
Comments
Btw I've just published Just importing this instead of the regular Also |
Good suggestions we should do this. |
@knsv do you want me to submit a PR for this? |
Yes please. That would be much appreciated |
Awesome! I'll try to fix the file under |
When installed mermaid is pretty heavy on disk, requiring about 39MB of stuff to be downloaded. I see pre-bundled versions of the library are provided under the
dist
directory, but I think there are still some simple ways to make the bundles significantly smaller, I propose to make the following changes:moment
with withdayjs
.moment
is a notoriously heavy library, and we are only using it for formatting some dates. Even if we are not using all othermoment
's many features or provided localizations we are still paying for them in the bundle.lodash
. The whole oflodash
is currently included in the bundle, even though out of the 330+ provided methods only the following ones are being used:each
,extend
,find
,isArray
,isString
,map
,maxBy
,orderBy
,uniqBy
. I propose to replace some of these with plain JS (each
,map
,isString
,isArray
,find
, maybe alsoextend
), unless very old browsers are supposed to be supported, and require the specific modules for the others (lodash.maxBy
,lodash.orderBy
andlodash.uniqBy
).src
directory to NPM. Here we are including it in the published package, I don't see why that'd be useful to the end user, so I propose to avoid publishing that folder.I'd like to submit PRs implementing these suggestions, would those PRs be welcome? @knsv @tylerlong
Thanks!
The text was updated successfully, but these errors were encountered: