chore: replace lodash with lodash.isequalwith#634
chore: replace lodash with lodash.isequalwith#634wojtekmaj wants to merge 1 commit intotesting-library:mainfrom wojtekmaj:no-whole-lodash
Conversation
Since we're only using one method from the entire lodash package, we can dramatically reduce @testing-library/jest-dom's install footprint (by roughly 1.3 MB) by replacing lodash (https://packagephobia.com/result?p=lodash) with lodash.isequalwith (https://packagephobia.com/result?p=lodash.isequalwith).
|
https://lodash.com/per-method-packages These per method packages are deprecated. Most projects already have lodash installed via transient dependencies anyway. |
|
This is a vicious circle. lodash is being installed everywhere because it's already installed everywhere. |
|
Yes someone has to start this, we can't all go around pointing fingers at the other packages saying "we won't optimize because the other's aren't". The per-function modules are indeed deprecated, but I think it's the best we can do right now with lodash. |
|
The problem with per function modules is that they bloat the runtime of the program. If we look how lodash is used across this organization: There are multiple lodash packages installed, both full version of lodash and per module. I would prefer that my dependencies of my projects have the small number of well vetted transient dependencies. If we want to optimize, we should use lodash/ everywhere. This would make runtime cost small and be compatible with future lodash v5. Saying all that, runtime cost would be both influenced by how often module is required (lodash/isEqualWith have higher require cost). If lodash function is loaded once during test run vs loaded on every test file. |
|
Then maybe we should take a different turn and migrate to es-toolkit across all the repos? |
|
yes you can see es-toolkit migration at this PR #671 |
|
Superseded by #676 |
What:
Continues effort from #593; further improves on #592
Why:
Since we're only using one method from the entire lodash package, we can dramatically reduce @testing-library/jest-dom's install footprint (by roughly 1.3 MB) by replacing lodash (https://packagephobia.com/result?p=lodash) with lodash.isequalwith (https://packagephobia.com/result?p=lodash.isequalwith).
How:
Checklist: