-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
deps(lodash): migrate lodash to lodash-es #16211
deps(lodash): migrate lodash to lodash-es #16211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested the bundle size, we go from 1807771 bytes to 1806087 bytes (so a savings of ~1.6KB)
cli/test/smokehouse/frontends/lib.js
Outdated
@@ -12,7 +12,7 @@ | |||
|
|||
/* eslint-disable no-console */ | |||
|
|||
import cloneDeep from 'lodash/cloneDeep.js'; | |||
import cloneDeep from 'lodash-es/cloneDeep.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect the advantage of tree-shaking to be that we can import everything from the top-level entry point now. For example:
import cloneDeep from 'lodash-es/cloneDeep.js'; | |
import {cloneDeep} from 'lodash-es'; |
Is this something you could do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will make the changes 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are done
How can i generate a metafile to check the bundle? I am trying to run the build but having multiple issues. I guess the command should be This is the error i get:
|
I just checked the bundle size myself (1806556 bytes, so still good) Not sure what the issue is exactly, are you running on windows? Might be an issue with |
|
Summary
Improve Tree-Shaking and bundling by migrating from
lodash
tolodash-es
.Even tho we are now using individual imports as of #13914 we are still using ComonJS. But since the rest of the repo seems to have migrated to ESM we can now use the ESM packages for
lodash
which islodash-es
.An addition benefit of this is that if the code is bundles futher by esbuild it will not require wrapping the use of lodash like this:
Related Issues/PRs