-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Lodash: Refactor away from _.isPlainObject()
#42508
Conversation
Size Change: +200 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
30b6ab9
to
9ecb68c
Compare
@@ -36,6 +36,7 @@ module.exports = { | |||
transform: { | |||
'^.+\\.[jt]sx?$': '<rootDir>/test/unit/scripts/babel-transformer.js', | |||
}, | |||
transformIgnorePatterns: [ 'node_modules/(?!(is-plain-obj))' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, is Jest still having issues with ES modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! If we ditch that, a bunch of unit tests where this module is directly or transitively used will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on an alternative approach 👍🏻
9ecb68c
to
0891410
Compare
0891410
to
567c4f2
Compare
@gziolo I've just rebased and addressed your suggestions - if I may ask you for one last look on this one - thanks 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to list dev dependencies in individual packages that use them. See https://github.com/WordPress/gutenberg/tree/trunk/packages#development-dependencies.
Everything else looks great 👍🏻
🚢 |
Hey @tyxla , I think this should probably have been a major release since it causes build breakage downstream unless configuration changes are made to support transforming is-plain-obj |
@rjchow, it definitely created more friction than we anticipated. Apparently, the Node ecosystem is far from ready to start using ES Modules today. I would rather avoid calling it a breaking change since it doesn't have any impact on the functionality of the updated packages. Is it only Jest that has issues with this package? We should fix it with the revised patch that @tyxla opened yesterday. If this impacts more tools, then maybe we should switch to another library that still supports CommonJS like |
I'm happy to replace the library if need be, but from the data we have so far, it seems like only Jest has issues, and #43271 should be solving that. |
Ok, let's try that first and keep |
What?
This PR removes the
_.isPlainObject()
usage completely and deprecates the function.Alternative to #42471.
Part of #16938.
Why?
Lodash is known to unnecessarily inflate the bundle size of packages, and in most cases, it can be replaced with native language functionality. See these for more information and rationale:
@wordpress/api-fetch
package haslodash
as a dependency #39495How?
We're using the is-plain-obj package because it does exactly what we want, has type bindings, and is simple and well-contained enough.
Testing Instructions