Skip to content

Conversation

@sethidden
Copy link
Contributor

@sethidden sethidden commented Jun 9, 2022

lodash per-function packages are discouraged in the lodash docs (see M2-720 description for more details).

eg. lodash.debounce was last updated 6 years ago, yet lodash-es's repo has changed to debounce 3 years ago, so the per-package modules are not updated

In case you're worried this will increase the bundle size since there's one big package rather than 3 small ones - the difference between the lodash-es and lodash package on NPM is that lodash-es is published as an ES module, so doing things like

import _ from 'lodash-es'
_.debounce(() => {})

will put only files related to debounce into the bundle, not whole lodash (if you wrote from 'lodash' though, it'd import it all)

The main bundle generated in this PR is 500 bytes heavier than develop, but avoids the pitfalls mentioned in M2-720 lodash docs link

terser@^5.3.4, terser@^5.7.2:
version "5.11.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-5.11.0.tgz#2da5506c02e12cd8799947f30ce9c5b760be000f"
integrity sha512-uCA9DLanzzWSsN1UirKwylhhRz3aKPInlfmpGfw8VN6jHsAtu8HJtIpeeHHK23rxnE/cDc+yvmq5wqkIC6Kn0A==
Copy link
Contributor Author

@sethidden sethidden Jun 9, 2022

Choose a reason for hiding this comment

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

I also messed with the terser in yarn.lock a bit - hopefully now yarn add works fine without the need for the lerna trick. I welcome you to checkout this branch and see for yourself if eg. yarn add is-odd (example package name) works (please run yarn before yarn add if something doesn't work)

@sethidden sethidden force-pushed the M2-720-use-lodash-es branch from 4a6f787 to 7480141 Compare June 9, 2022 23:22
@Frodigo Frodigo added this to the 1.0.0-rc.9 milestone Jun 10, 2022
@Frodigo Frodigo merged commit 918795f into develop Jun 10, 2022
@Frodigo Frodigo deleted the M2-720-use-lodash-es branch June 10, 2022 05:51
Frodigo added a commit that referenced this pull request Jun 10, 2022
Frodigo pushed a commit that referenced this pull request Jun 10, 2022
@Frodigo Frodigo removed this from the 1.0.0-rc.9 milestone Jun 10, 2022
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.

3 participants