Skip to content

Conversation

@saurabhdaware
Copy link
Member

This import was adding entire lodash bundle. There are some issues with tree-shaking which I am figuring out but this was a quickfix

Before - 47kb

image

After - 23kb

image

@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2023

🦋 Changeset detected

Latest commit: d2be401

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@razorpay/blade Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

✅ PR title follows Conventional Commits specification.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 9, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d2be401:

Sandbox Source
razorpay/blade: basic Configuration

@@ -1,5 +1,5 @@
import { isEmpty } from 'lodash';
Copy link
Collaborator

Choose a reason for hiding this comment

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

😢

divyanshu013
divyanshu013 previously approved these changes Mar 9, 2023
Copy link
Contributor

@divyanshu013 divyanshu013 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

"@razorpay/blade": patch
---

fix: lodash tree shaking. Reduce lodash bundle size from 47kb -> 23kb
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's instead reword - reduce effective bundle size ... :)

@@ -1,5 +1,5 @@
import { isEmpty } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably need lodash esm or webpack lodash plugin if we don't want to do 'lodash/isEmpty'

Copy link
Member Author

Choose a reason for hiding this comment

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

yup. I think we're anyway re-exporting it. auto-import imported it and I didn't notice earlier ;__;

We can have some eslint rules to disable these imports.

@kamleshchandnani kamleshchandnani merged commit da4489b into master Mar 13, 2023
@kamleshchandnani kamleshchandnani deleted the saurabh/fix/lodash-bundlesize branch March 13, 2023 12:45
anuraghazra pushed a commit that referenced this pull request Apr 9, 2024
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.

5 participants