From 00cf35180ee773ed55b788f9263b59b32e632bd3 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 19 Nov 2021 17:20:25 +0530 Subject: [PATCH] refactor: code --- lib/Server.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/Server.js b/lib/Server.js index 30c68993d8..4220156c21 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -447,10 +447,6 @@ class Server { const compilerWatchOptions = compilerOptions.watchOptions || {}; const getDefaultWatchOptions = (watchOptions = {}) => { - watchOptions = { - ...compilerWatchOptions, - ...watchOptions, - }; // duplicate the same massaging of options that watchpack performs // https://github.com/webpack/watchpack/blob/master/lib/DirectoryWatcher.js#L49 // this isn't an elegant solution, but we'll improve it in the future @@ -468,17 +464,14 @@ class Server { : // eslint-disable-next-line no-undefined undefined; - if (watchOptions.poll) { - delete watchOptions.poll; - } - - const finalWatchOptions = { + const { poll, ...finalWatchOptions } = { ignoreInitial: true, persistent: true, followSymlinks: false, atomic: false, alwaysStat: true, ignorePermissionErrors: true, + ...compilerWatchOptions, ...watchOptions, ignored: watchOptions.ignored, usePolling,