diff --git a/plugins/woocommerce-blocks/bin/webpack-helpers.js b/plugins/woocommerce-blocks/bin/webpack-helpers.js index 2ae9ad47cd3..2f0d7c5c0c1 100644 --- a/plugins/woocommerce-blocks/bin/webpack-helpers.js +++ b/plugins/woocommerce-blocks/bin/webpack-helpers.js @@ -115,6 +115,12 @@ const stableMainEntry = { 'snackbar-notice-style': './node_modules/wordpress-components/src/snackbar/style.scss', + // Styles for grid blocks. WP <=5.2 doesn't have the All Products block, + // so this file would not be included if not explicitly declared here. + // This file is excluded from the default build so CSS styles are included + // in the other the components are imported. + 'product-list-style': './assets/js/base/components/product-list/style.scss', + // Blocks 'handpicked-products': './assets/js/blocks/handpicked-products/index.js', 'product-best-sellers': './assets/js/blocks/product-best-sellers/index.js', diff --git a/plugins/woocommerce-blocks/webpack.config.js b/plugins/woocommerce-blocks/webpack.config.js index 787f604ad52..72f5f699ed7 100644 --- a/plugins/woocommerce-blocks/webpack.config.js +++ b/plugins/woocommerce-blocks/webpack.config.js @@ -108,7 +108,14 @@ const CoreConfig = { const GutenbergBlocksConfig = { ...baseConfig, - ...getMainConfig( { alias: getAlias() } ), + ...getMainConfig( { + alias: getAlias(), + // This file is already imported by the All Products dependencies, + // so we can safely exclude it from the default build. It's still + // needed in the legacy build because it doesn't include the + // All Products block. + exclude: [ 'product-list-style' ], + } ), }; const BlocksFrontendConfig = {