Skip to content

Use specific packages from lodash instead of whole library - #534

Closed
itsmichaeldiego wants to merge 11 commits into
masterfrom
remove-lodash
Closed

itsmichaeldiego wants to merge 11 commits into
masterfrom
remove-lodash

Conversation

@itsmichaeldiego

@itsmichaeldiego itsmichaeldiego commented Mar 11, 2018 •

Copy link
Copy Markdown
Member

This PR is just one proposal to use specific packages from lodash instead of importing the whole library.

I came across with the problem that we tried to remove lodash here: 670fadd#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R72 but we actually moved to devDependencies.

But accidentally, because it was there, @ZAKdev used fp from lodash, as it was still in the devdependencies, in #441.

After that, I also used isEmpty from lodash in #533

This increased the build size to 797kb standard and 201kb minified.

This PR decreases it to 398kb and 93.1kb minified.

Output: Size decreased by more than 50%

Prev:

screen shot 2018-03-11 at 2 00 52 pm

Now:

screen shot 2018-03-11 at 1 59 57 pm

Comment thread src/google_heatmap.js
@@ -1,8 +1,9 @@
import fp from 'lodash/fp';
import map from 'lodash.map';
import reduce from 'lodash.reduce';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of importing functions map and reduce from lodash, we can simply call native map reduce functions. If you agree i can change in this PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZAKdev If you can make a separate PR doing that, I can handle the rest. This is my first option, but the second one would be using all our own utils instead. So for both options the change you're proposing would be great.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZAKdev Either way I go, your change independently will decrease the size of the build.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itsmichaeldiego, Ok i will do it in separate PR, i will open a PR soon and let me know if i can help you more to decrease the size of build.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZAKdev Thanks, it will be really helpful for you to change the reduce and map given that you can test the changes in the heatmap and see if it works, thanks for that! I will be waiting on this, do you think you can do it today? ♥️

@itsmichaeldiego
itsmichaeldiego deleted the remove-lodash branch March 12, 2018 02:53
@itsmichaeldiego
itsmichaeldiego restored the remove-lodash branch March 12, 2018 03:13
@itsmichaeldiego

Copy link
Copy Markdown
Member Author

I am going for #535 as for now.

@itsmichaeldiego
itsmichaeldiego deleted the remove-lodash branch March 12, 2018 23:03
@ZAKdev

ZAKdev commented Apr 12, 2018

Copy link
Copy Markdown
Contributor

@itsmichaeldiego, i don't have access anymore to push my code.

@lock

lock Bot commented Dec 1, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants