From 6f85ab593f6b4c0f4ec335fec7a29f0483e6a571 Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Wed, 2 Nov 2022 10:24:19 +0000 Subject: [PATCH] Use backslashes to fix webpack build on windows (https://github.com/woocommerce/woocommerce-blocks/pull/6798) * Use backslashes to fix webpack build on windows * Update regex to use square brackets, and update copywebpack path for Windows Co-authored-by: Seghir Nadir --- plugins/woocommerce-blocks/bin/webpack-configs.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce-blocks/bin/webpack-configs.js b/plugins/woocommerce-blocks/bin/webpack-configs.js index ef858982c40..189c3167031 100644 --- a/plugins/woocommerce-blocks/bin/webpack-configs.js +++ b/plugins/woocommerce-blocks/bin/webpack-configs.js @@ -227,7 +227,7 @@ const getMainConfig = ( options = {} ) => { automaticNameDelimiter: '--', cacheGroups: { commons: { - test: /[\\/]node_modules[\\/]/, + test: /[\/\\]node_modules[\/\\]/, name: 'wc-blocks-vendors', chunks: 'all', enforce: true, @@ -277,7 +277,6 @@ const getMainConfig = ( options = {} ) => { if ( metadata.parent ) return `./inner-blocks/${ blockName }/block.json`; - return `./${ blockName }/block.json`; }, }, @@ -658,7 +657,7 @@ const getStylingConfig = ( options = {} ) => { priority: 10, }, vendorsStyle: { - test: /\/node_modules\/.*?style\.s?css$/, + test: /[\/\\]node_modules[\/\\].*?style\.s?css$/, name: 'wc-blocks-vendors-style', chunks: 'all', priority: 7, @@ -676,7 +675,7 @@ const getStylingConfig = ( options = {} ) => { module: { rules: [ { - test: /\/node_modules\/.*?style\.s?css$/, + test: /[\/\\]node_modules[\/\\].*?style\.s?css$/, use: [ MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { importLoaders: 1 } }, @@ -731,6 +730,9 @@ const getStylingConfig = ( options = {} ) => { if ( relativePath.startsWith( 'assets/css/abstracts/' + ) || + relativePath.startsWith( + 'assets\\css\\abstracts\\' ) ) { return content;