Commit 5af556c3764 for woocommerce

commit 5af556c3764b0740542311e849d60d41486b8d51
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Thu May 21 09:41:01 2026 +0200

    Avoid building unnecessary styling files in legacy Product Filters block (#65206)

    * Avoid building unnecessary styling files in Product Filters block

    * Add changelog

    * Simplify code

diff --git a/plugins/woocommerce/changelog/fix-filters-wrapper-styling-files b/plugins/woocommerce/changelog/fix-filters-wrapper-styling-files
new file mode 100644
index 00000000000..61ed8a1be3a
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-filters-wrapper-styling-files
@@ -0,0 +1,5 @@
+Significance: patch
+Type: tweak
+Comment: Avoid building unnecessary styling files in Product Filters block
+
+
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/block.tsx
index ae365162ef5..69d939ae514 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/block.tsx
@@ -6,7 +6,6 @@ import { useRef } from '@wordpress/element';
 /**
  * Internal dependencies
  */
-import './register-components';
 import { FilterBlockContext } from './context';

 type Props = {
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/frontend.ts b/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/frontend.ts
index 9142e28e45c..d96f547b498 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/frontend.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/filter-wrapper/frontend.ts
@@ -7,6 +7,7 @@ import { getRegisteredBlockComponents } from '@woocommerce/blocks-registry';
 /**
  * Internal dependencies
  */
+import './register-components';
 import Block from './block';

 renderParentBlock( {
diff --git a/plugins/woocommerce/client/blocks/bin/webpack-entries.js b/plugins/woocommerce/client/blocks/bin/webpack-entries.js
index 28f089fb72e..23a0069f0a6 100644
--- a/plugins/woocommerce/client/blocks/bin/webpack-entries.js
+++ b/plugins/woocommerce/client/blocks/bin/webpack-entries.js
@@ -69,7 +69,10 @@ const blocks = {
 	'featured-product': {
 		customDir: 'featured-items/featured-product',
 	},
-	'filter-wrapper': {},
+	'filter-wrapper': {
+		// Frontend-only lazy component registration; exclude from styling build.
+		skipStyling: true,
+	},
 	'handpicked-products': {},
 	// We need to keep the legacy-template id, so we need to add a custom config to point to the renamed classic-template folder
 	'legacy-template': {
@@ -311,7 +314,10 @@ const blockStylingEntries = getBlockEntries(
 				...blocks,
 				...genericBlocks,
 				...cartAndCheckoutBlocks,
-			} ).filter( ( [ blockName ] ) => {
+			} ).filter( ( [ blockName, config ] ) => {
+				if ( config.skipStyling ) {
+					return false;
+				}
 				return ! frontendScriptModuleBlocksToSkip.includes(
 					`woocommerce/${ blockName }`
 				);