Skip to content

Commit

Permalink
cli: fix watch options for array config (#892)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chaseadamsio authored and ematipico committed May 27, 2019
1 parent cad6744 commit 0c97480
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/cli.js
Expand Up @@ -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
Expand Down

0 comments on commit 0c97480

Please sign in to comment.