-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
@wordpress/api-fetch
package has lodash
as a dependency
#39495
Comments
There is a more high-level issue that opened a long time ago: #17025. I think there is a common agreement that we could replace |
There is also #16938 that is still open for |
For reference, this here is the only instance of
|
String.prototype.trim() is a simple one to use as replacement.
|
We could probably have to re-implement Few folks also pointed out that |
@Mamaduka I didn't know that PHP function existed. If we were to port it to JS where should it live? 🤔 Would it be it's own |
Do we use it outside of |
But the usage in the |
We could potentially replace most of them with updated |
The question would be if making |
Probably not, but we don't need to replace them all. We can start with cases where strings are used for slugs. |
I think that would be a good first step. We can decide later whether it makes sense to extract to its own package. |
I'm planning to start working incrementally on removing Lodash completely from the repository. Usage is not so high, and the bundle size impact will be huge for some of the packages when used externally. |
@tyxla That is awesome to hear <3 The biggest hurdle for me when looking into removing lodash from the If you find a way to remove that dependency that will have a huge impact on the ability to use various |
Good to know @fabiankaegy 👍 We'll most likely end up having to introduce either a few new utility functions or reusing some well-established implementations that are broadly adopted by the community. |
I took a shot at #39495 (comment) but failed because I don't really have a good enough understanding of the underlying text encoding. |
Interesting. Luckily, a few years ago I did implement an almost exact replica of the WP core It seems to be used quite extensively, and I couldn't be happier to spend more time maintaining it than if it was used in Gutenberg. It could be one way to get rid of |
The
@wordpress/api-fetch
package is super useful even outside of the context of the editor. In theory it would be a great package to use on the frontend of any WordPress site to interact with the WordPress Rest API.Currently however it relies on the
@wordpress/url
package which intern has a dependency onlodash
. Because of that the size of the@wordpress/api-fetch
npm package is230 kB
making it un suitable for the sage on the frontend.The text was updated successfully, but these errors were encountered: