Right now lodash is used throughout various @wordpress packages in this repo because it's convenient and handles a lot of mundane things/logic that aren't worth duplicating. However there is a cost to using it:
- Size:
lodash.min.js is 73.3kb
- Increased potential for conflicts with plugins/themes also using lodash.
For this issue, I'd like to propose that we eliminate lodash usage across all our repository packages to reduce/remove the cost incurred by it. To do so:
Initially, I've started with @wordpress/element dependency here.
I'm willing to spearhead this and get it completed, but before I begin, here's some decisions that we should make to move forward on this issue:
-
Is removing lodash dependency something we want to do? Everywhere or just select packges?
-
Should we create a new package to contain specific lodash functions (like _.kebabCase) that can be used where needed instead of lodash? If yes, what name should we give the package. What conventions should we describe for what is allowed in the package?
Right now lodash is used throughout various
@wordpresspackages in this repo because it's convenient and handles a lot of mundane things/logic that aren't worth duplicating. However there is a cost to using it:lodash.min.jsis 73.3kbFor this issue, I'd like to propose that we eliminate lodash usage across all our repository packages to reduce/remove the cost incurred by it. To do so:
_.kebabCaseor_.isPlainObjectmight be good candidates for this package. Difficulty here would be how to name this package and clearly defining what goes in it (we don't want it becoming a "catch all" type of package.@wordpress/*packages.Initially, I've started with
@wordpress/elementdependency here.I'm willing to spearhead this and get it completed, but before I begin, here's some decisions that we should make to move forward on this issue:
Is removing
lodashdependency something we want to do? Everywhere or just select packges?Should we create a new package to contain specific lodash functions (like
_.kebabCase) that can be used where needed instead of lodash? If yes, what name should we give the package. What conventions should we describe for what is allowed in the package?