Skip to content
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

Minimize Lodash Footprint #210

Merged
merged 1 commit into from
Jul 19, 2020
Merged

Minimize Lodash Footprint #210

merged 1 commit into from
Jul 19, 2020

Conversation

chaffeqa
Copy link

@chaffeqa chaffeqa commented Jul 19, 2020

Issue

Though for a while Lodash promoted the ability to treeshake automatically, we have found that doesnt seem to work in any of our cases (we've tried the babel/webpack plugin and run into similar issues as others.

Anyways, in our build we noticed slate-plugins was bundling a large part of lodash:
Screenshot 2020-07-19 09 36 21

I'm hoping by using the per method approach, the build process will properly treeshake and reduce that footprint.

What I did

Replaced all imports of Lodash functions with the named function import

Checklist

  • The new code matches the existing patterns and styles.
  • The stories still work (run yarn storybook).
  • The stories are updated when relevant: stories for plugins, knobs for options.

@chaffeqa chaffeqa requested a review from zbeyens as a code owner July 19, 2020 17:13
@codecov
Copy link

codecov bot commented Jul 19, 2020

Codecov Report

Merging #210 into next will increase coverage by 2.64%.
The diff coverage is 97.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #210      +/-   ##
==========================================
+ Coverage   89.70%   92.35%   +2.64%     
==========================================
  Files         309      258      -51     
  Lines        2399     2406       +7     
  Branches      505      362     -143     
==========================================
+ Hits         2152     2222      +70     
+ Misses        247      184      -63     
Impacted Files Coverage Δ
packages/core/src/components/EditablePlugins.tsx 100.00% <ø> (ø)
packages/core/src/utils/onDOMBeforeInputPlugins.ts 100.00% <ø> (ø)
packages/core/src/utils/onKeyDownPlugins.ts 100.00% <ø> (ø)
packages/core/src/utils/renderElementPlugins.tsx 100.00% <ø> (ø)
packages/core/src/utils/renderLeafPlugins.tsx 100.00% <ø> (ø)
...s/slate-plugins/src/common/queries/isMarkActive.ts 100.00% <ø> (ø)
...ges/slate-plugins/src/common/queries/isNodeType.ts 100.00% <ø> (ø)
...on/utils/normalizeDescendantsToDocumentFragment.ts 100.00% <ø> (ø)
...te-plugins/src/decorators/preview/PreviewPlugin.ts 100.00% <ø> (ø)
...s/deserialize-html/utils/deserializeHTMLElement.ts 100.00% <ø> (ø)
... and 321 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6440b13...97ed672. Read the comment docs.

@zbeyens
Copy link
Member

zbeyens commented Jul 19, 2020

Thanks for the PR, let's try!

@zbeyens zbeyens merged commit 1030b7a into udecode:next Jul 19, 2020
@chaffeqa chaffeqa deleted the feature/reduce-lodash-footprint branch July 19, 2020 18:19
@chaffeqa
Copy link
Author

It worked! Results below:

Screenshot 2020-07-19 12 20 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants