-
-
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
Why are lodash imports as named imports? This adds the entire lodash to the dist #9778
Comments
@lgraziani2712I'm fine with this change and would appreciate a PR fixing this across the board. 🙏 @patricklafrance you told me that it should be tree-shaken out of the build, but it sounds like that's not working and it's easier to change it in our code than to force our users to get tree-shaking working in theirs. please speak up if you think this is a bad idea! |
I might be wrong, this is hard to test since most of storybook dependencies also have a dependency on lodash and it might be these dependencies who are importing a complete version of lodash. I dont mind changing this. |
Haven't test if it's right but I keep reading the following:
|
Hmm I think what that citation says is that importing things like |
@lgraziani2712 thanks for putting together the fix. i'm going to merge and release your PR after CI finishes. Hoping you can verify the fix after it's released! 🙏 |
@lgraziani2712 released on 6.0.0-alpha.8 |
Awesome @lgraziani2712 !!! 🚀 |
Describe the bug
Lodash is being imported as if was an es-module, but it isn't, so is adding me the entire lodash/lodash.js file plus all the specific modules I'm importing.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
To not have the entire lodash module plus each lodash function in the final bundle.
Screenshots
Code snippets
This could be solved by importing each lodash modules specifically. E.g:
Instead of:
Would be:
Additional context
I would gladly fix it in a PR if its OK.
Thank you!
The text was updated successfully, but these errors were encountered: