-
Notifications
You must be signed in to change notification settings - Fork 50
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
import throttle from 'lodash/throttle' is actually better at reducing bundle size than 'lodash.throttle' #55
Comments
jedwards1211
changed the title
import throttle from 'lodash/throttle' is actually better at reducing bundle size than
import throttle from 'lodash/throttle' is actually better at reducing bundle size than 'lodash.throttle'
Aug 21, 2019
lodash.throttle
Here's a demonstration of this. Since
|
thanks for the info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See lodash/lodash#3838
If two lodash per-method packages, e.g.
lodash.throttle
andlodash.debounce
, depend on an underlying lodash function (public or internal API), that function will be inlined in each of the modular build packages, bloating webpack bundle size. The modular build packages can't share any code.On the other hand, if your package imports from
lodash/throttle
, and another package imports fromlodash/debounce
, they can share any underlying code they depend on and the webpack bundle will be smaller.So the per-method packages really have no advantages, and John-David Dalton pointed out that they're going to be removed in v5.
Having
lodash
as a dependency is perfectly fine as long as you always import from submodules, never its root module.The text was updated successfully, but these errors were encountered: