react-throttle icon indicating copy to clipboard operation
react-throttle copied to clipboard

Are you loading the entire lodash library?

Open artboard-studio opened this issue 9 years ago • 7 comments

Hi

Is this plugin loading the entire lodash library? Any way to avoid that and just load the necessary things?

artboard-studio avatar Jan 02 '17 15:01 artboard-studio

Yes, in https://github.com/gmcquistin/react-throttle/blob/master/src/classes/processors/Base.js

If you raise a PR for that, I could merge it in. Or I can do it myself when I have a spare moment. :)

Thank you!

gmcquistin avatar Jan 13 '17 16:01 gmcquistin

I am seeing the same in my project

screen shot 2017-02-01 at 17 18 03

I am not familiar with lodash. Who can we improve this?

Source: https://github.com/th0r/webpack-bundle-analyzer

MoOx avatar Feb 01 '17 16:02 MoOx

@MoOx lodash.js is basically the same as underscore.js which are both utility belts for javascript (array and object etc. helper functions) which in my opinion are becoming redundant with all the new cool stuff added in ES6 and ES7 (though still some useful functions could be found in lodash.js or underscore.js)

The way to improve react-throttle library is to use only the debounce throttle functions that could found here instead of using a huge library like lodash.js just for these two functions. Unfortunately, I still haven't found the time to raise a PR for it, but the present library is the best one available for using throttle-debounce in react since it could get very tricky doing it manually.

By the way, which tool did you use to generate your screenshot? Seems to be useful.

artboard-studio avatar Feb 01 '17 16:02 artboard-studio

https://github.com/th0r/webpack-bundle-analyzer

MoOx avatar Feb 01 '17 16:02 MoOx

I see multiple places that use lodash https://github.com/gmcquistin/react-throttle/search?utf8=✓&q=lodash

I think we should directly cherry pick modules.

MoOx avatar Feb 01 '17 17:02 MoOx

Thanks for the feedback, guys. I will work on this soon and raise a PR for you guys to review.

gmcquistin avatar Feb 01 '17 17:02 gmcquistin

@gmcquistin Since you are already transpiling with babel, consider using babel-plugin-lodash and it will do the cherry picking automatically for you during build time..

yoadsn avatar Feb 26 '17 14:02 yoadsn