Commit 8c0c2bcea72 for woocommerce
commit 8c0c2bcea72874c9e34d7aefff0618c1d52c2d81
Author: Miroslav Mitev <m1r0@users.noreply.github.com>
Date: Wed Aug 19 18:36:08 2026 +0300
Fix Blocks build failure in checkout paths containing "style", "editor" or "frontend" (#67730)
* Fix interactivity block entries matching against the full path
diff --git a/plugins/woocommerce/changelog/fix-blocks-interactivity-entries-path-substring b/plugins/woocommerce/changelog/fix-blocks-interactivity-entries-path-substring
new file mode 100644
index 00000000000..054a7bb095c
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-blocks-interactivity-entries-path-substring
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Select interactivity block build assets by file name instead of by substring of the absolute path, so the Blocks build works in checkout directories containing "style", "editor" or "frontend".
diff --git a/plugins/woocommerce/client/blocks/bin/webpack-interactivity-entries.js b/plugins/woocommerce/client/blocks/bin/webpack-interactivity-entries.js
index b6ed4c12bea..af3e713b175 100644
--- a/plugins/woocommerce/client/blocks/bin/webpack-interactivity-entries.js
+++ b/plugins/woocommerce/client/blocks/bin/webpack-interactivity-entries.js
@@ -11,7 +11,11 @@ function blockSupportsInteractivity( blockJson ) {
}
function findInteractivityBlockAssets( dir = [] ) {
- const additionalPatterns = [ 'frontend.*s', 'style.scss', 'editor.scss' ];
+ const additionalPatterns = [
+ '{frontend.ts,frontend.js}',
+ 'style.scss',
+ 'editor.scss',
+ ];
let results = [];
const ents = fs.readdirSync( dir, { withFileTypes: true } );
@@ -97,7 +101,9 @@ const interactivityBlocks = findInteractivityBlockAssets(
);
const scriptModuleEntries = interactivityBlocks.reduce( ( acc, block ) => {
- const frontendFile = block.assets.find( ( f ) => f.includes( 'frontend' ) );
+ const frontendFile = block.assets.find( ( f ) =>
+ [ 'frontend.ts', 'frontend.js' ].includes( path.basename( f ) )
+ );
if ( frontendFile ) {
acc[ block.blockName ] = frontendFile;
}
@@ -105,7 +111,9 @@ const scriptModuleEntries = interactivityBlocks.reduce( ( acc, block ) => {
}, {} );
const styleEntries = interactivityBlocks.reduce( ( acc, block ) => {
- const styleFile = block.assets.find( ( f ) => f.includes( 'style' ) );
+ const styleFile = block.assets.find(
+ ( f ) => path.basename( f ) === 'style.scss'
+ );
if ( styleFile ) {
acc[ `${ block.blockName }-style` ] = styleFile;
}
@@ -113,7 +121,9 @@ const styleEntries = interactivityBlocks.reduce( ( acc, block ) => {
}, {} );
const editorStyleEntries = interactivityBlocks.reduce( ( acc, block ) => {
- const editorFile = block.assets.find( ( f ) => f.includes( 'editor' ) );
+ const editorFile = block.assets.find(
+ ( f ) => path.basename( f ) === 'editor.scss'
+ );
if ( editorFile ) {
acc[ `${ block.blockName }-editor` ] = editorFile;
}