diff --git a/lib/Server.js b/lib/Server.js index d33c3f9463..0a7610d34f 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -447,6 +447,10 @@ 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 @@ -464,6 +468,10 @@ class Server { : // eslint-disable-next-line no-undefined undefined; + if (watchOptions.poll) { + delete watchOptions.poll; + } + const finalWatchOptions = { ignoreInitial: true, persistent: true, @@ -471,17 +479,12 @@ class Server { atomic: false, alwaysStat: true, ignorePermissionErrors: true, - ...compilerWatchOptions, ...watchOptions, ignored: watchOptions.ignored, usePolling, interval, }; - if (finalWatchOptions.poll) { - delete finalWatchOptions.poll; - } - return finalWatchOptions; };