WordPress components no longer bundled with WooCommerce Admin

tl;dr

As of WooCommerce Admin 1.9, the @wordpress/components package is no longer bundled as part of the WooCommerce Admin codebase.

The Details

Early on in the development of WooCommerce Admin, the maintainers decided to bundle the @wordpress/components package with WooCommerce Admin. This helped ensure all of the features WooCommerce Admin relies on, notably React hooks, would be available to WooCommerce Admin, even if they weren’t present in the versions of WordPress that WooCommerce supported.

With the recent release of WordPress 5.6.0, WooCommerce now requires a minimum of WordPress 5.4.0, which includes the React features that WooCommerce Admin relies on. Because of this, WooCommerce Admin now simply enqueues wp.components instead of bundling its own version. You can read more about how this switch occurred in the associated Pull Request on GitHub.

The most notable consequence of this change is a ~650kb reduction in the bundle size, which should result in a welcome performance improvement, but there are other consequences that developers should be aware of if they are affected.

How might this affect my development workflow?

Developers who are building for and contributing to WooCommerce Admin should take care to ensure that any components and respective APIs they use are available in all supported versions. WooCommerce currently supports the latest release of WordPress plus the latest release from the two previous release branches (L-2). To find out if a component is available in a particular version, you can reference the Version Table in the WordPress Block Editor Handbook to see which versions of Gutenberg exist in which versions of WordPress. From there, you can check the respective release branch in the Gutenberg respository on GitHub to check for a component in the latest version.


If you have questions or feedback, please don’t hesitate to share them with us in the comments below or in the #developers channel of the WooCommerce Community Slack.


Leave a Reply

Your email address will not be published. Required fields are marked *