From 0c97480b31ea374f69e81a967cdfd916fb8ebd58 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Mon, 27 May 2019 04:49:40 -0700 Subject: [PATCH] cli: fix watch options for array config (#892) Issue #4594 points out that watch options aren't being honored when the Webpack config is an Array. In cases when it's an array, there may not be a firstOptions.watchOptions, but there will be an options.watchOptions. In the current implementation, when the Webpack compiler watch method is called with watchOptions and the Webpack config is an array, watchOptions will be `true` and not an object. --- bin/cli.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cli.js b/bin/cli.js index 3819cda71a0..aea8f6fd3e4 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -349,7 +349,8 @@ For more information, see https://webpack.js.org/api/cli/.`); } } if (firstOptions.watch || options.watch) { - const watchOptions = firstOptions.watchOptions || firstOptions.watch || options.watch || {}; + const watchOptions = + firstOptions.watchOptions || options.watchOptions || firstOptions.watch || options.watch || {}; if (watchOptions.stdin) { process.stdin.on("end", function(_) { process.exit(); // eslint-disable-line