From b0ae1fbf72902064de277c2579d8f7d399a8b1f1 Mon Sep 17 00:00:00 2001 From: Paul Bunkham Date: Sun, 29 Aug 2021 20:12:39 +0100 Subject: [PATCH] Change the logic to support = syntax for specifying output filenames. --- packages/scripts/utils/config.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js index dd87f29f7ee09..a20cb77c4a297 100644 --- a/packages/scripts/utils/config.js +++ b/packages/scripts/utils/config.js @@ -131,13 +131,14 @@ const getWebpackArgs = () => { // The following handles the support for multiple entry points in webpack, e.g.: // `wp-scripts build one.js custom=./two.js` -> `webpack one=./one.js custom=./two.js` webpackArgs = webpackArgs.reduce( ( args, cliArg ) => { - if ( - getFileArgsFromCLI().includes( cliArg ) && - ! cliArg.includes( '=' ) - ) { - args.push( ...pathToEntry( cliArg ) ); - } else { + if ( ! getFileArgsFromCLI().includes( cliArg ) ) { args.push( cliArg ); + return args; + } + if ( cliArg.includes( '=' ) ) { + args.push( '--env', 'entries.' + cliArg ); + } else { + args.push( ...pathToEntry( cliArg ) ); } return args; }, [] );