-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature Request]: Drop per-method lodash dependencies #17731
Comments
Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team. |
@kubijo Thanks for bringing this up! I agree with all points, though I think we could first migrate existing usages to use lodash-es really easily and then later work on refactoring those to native methods. I don't think the codemod is what we want because it refactors to the main lodash package: - import get from 'lodash.get'
+ import get from "lodash/get"
- import mapValues from 'lodash.mapvalues'
+ import mapValues from "lodash/mapValues"
- require('lodash.get')
+ require("lodash/get")
- const sortBy = require('lodash.sortby')
+ const sortBy = require("lodash/sortBy") Whereas we'll instead be aiming for - import get from 'lodash.get'
+ import { get } from "lodash-es" |
The Carbon team has accepted this proposal! Our team doesn't have the capacity to work on this now, so we are requesting community contributors. Please see the labels for roles that are needed. If you are willing to help out, comment below and we will get in touch! |
@tay1orjones I see ... yeah, that does not look great ... the only utility I see would be that it primes your code with changes you would then rewrite, but a pretty simple regex-based search&replace does that too... |
I've also bumped into this thing: https://es-toolkit.slash.page/ through https://storybook.js.org/blog/storybook-8-4/#we-cut-bundle-size-in-half I did not hear about it previously, but it seems pretty cool if all they say is true... |
The problem
You are using several single-method lodash package dependencies in your codebase, which is discouraged even by the authors.
The reason I came up to this is that we have an app where size is a pretty big issue and inspection of the built artifact shows duplication of lodash code... (where the per-method ones are also needlessly big).
The solution
lodash-es
)[https://www.npmjs.com/package/lodash-es]… ideally with a very permissive range onlodash
version to make it more likely that it will get deduplicated.They also have some kind of code mod in the linked docs page, but I have not used it, so I cannot vouch for it.
Examples
No response
Application/PAL
No response
Business priority
High Priority = pressing release
Available extra resources
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: