Optimize Lodash imports to reduce bundle size#3980
Optimize Lodash imports to reduce bundle size#3980enagorny wants to merge 2 commits intojaredpalmer:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 5f49e03 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
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. |
|
Seeing a before and after comparison of the library size would be helpful. |
|
I found this which might be useful https://www.npmjs.com/package/@optimize-lodash/rollup-plugin As for whether Long story short, I'd say let's do deep imports or consider using that rollup plugin with tsdx. |
|
Since it's quite dead now at this point anyway you should be migrating to |
Description
This PR proposes to optimize Formik's use of Lodash by replacing the full Lodash library with individual method imports. This change aims to reduce the overall bundle size of projects using Formik by only including the specific Lodash methods that Formik requires.
Changes
lodashandlodash-espackageslodash.clone,lodash.clonedeep,lodash.isplainobject,lodash.topathMotivation
The full Lodash library is quite large, and Formik only uses a few methods from it. By importing only the necessary methods, we can significantly reduce the amount of unused code included in the final bundle.
Potential Impact
Testing
(Describe any testing you've done here. For example:)
Notes for Reviewers