Skip to content

Commit 9620eb1

Browse files
committed
refactor: code
1 parent 7fa443a commit 9620eb1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/Server.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ class Server {
447447
const compilerWatchOptions = compilerOptions.watchOptions || {};
448448

449449
const getDefaultWatchOptions = (watchOptions = {}) => {
450+
watchOptions = {
451+
...compilerWatchOptions,
452+
...watchOptions,
453+
};
450454
// duplicate the same massaging of options that watchpack performs
451455
// https://github.com/webpack/watchpack/blob/master/lib/DirectoryWatcher.js#L49
452456
// this isn't an elegant solution, but we'll improve it in the future
@@ -464,24 +468,23 @@ class Server {
464468
: // eslint-disable-next-line no-undefined
465469
undefined;
466470

471+
if (watchOptions.poll) {
472+
delete watchOptions.poll;
473+
}
474+
467475
const finalWatchOptions = {
468476
ignoreInitial: true,
469477
persistent: true,
470478
followSymlinks: false,
471479
atomic: false,
472480
alwaysStat: true,
473481
ignorePermissionErrors: true,
474-
...compilerWatchOptions,
475482
...watchOptions,
476483
ignored: watchOptions.ignored,
477484
usePolling,
478485
interval,
479486
};
480487

481-
if (finalWatchOptions.poll) {
482-
delete finalWatchOptions.poll;
483-
}
484-
485488
return finalWatchOptions;
486489
};
487490

0 commit comments

Comments
 (0)