Skip to content

Commit 1c6637b

Browse files
authored
Merge pull request webpack#5520 from civalin/bugfix/cli-watch-poll
fix: cli --watch-poll not accept number correctly
2 parents ef6ab68 + 5a2f7ea commit 1c6637b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

bin/config-yargs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ module.exports = function(yargs) {
172172
requiresArg: true
173173
},
174174
"watch-poll": {
175-
type: "boolean",
175+
type: "string",
176176
describe: "The polling interval for watching (also enable polling)",
177177
group: ADVANCED_GROUP
178178
},

bin/convert-argv.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ module.exports = function(yargs, argv, convertOptions) {
166166
options.watchOptions.aggregateTimeout = +argv["watch-aggregate-timeout"];
167167
}
168168

169-
if(argv["watch-poll"]) {
169+
if(typeof argv["watch-poll"] !== undefined) {
170170
options.watchOptions = options.watchOptions || {};
171-
if(typeof argv["watch-poll"] !== "boolean")
172-
options.watchOptions.poll = +argv["watch-poll"];
173-
else
171+
if(argv["watch-poll"] === "true" || argv["watch-poll"] === "")
174172
options.watchOptions.poll = true;
173+
else if(!isNaN(argv["watch-poll"]))
174+
options.watchOptions.poll = +argv["watch-poll"];
175175
}
176176

177177
if(argv["watch-stdin"]) {

0 commit comments

Comments
 (0)