fix fs stats.mtime usage in config.js

This commit is contained in:
Labhansh Agrawal 2020-01-02 20:18:46 +05:30 committed by Benjamin Staneck
parent f684093e94
commit 36e08165d6

View file

@ -30,10 +30,10 @@ const _watch = () => {
// watch for changes on config every 2s on Windows // watch for changes on config every 2s on Windows
// https://github.com/zeit/hyper/pull/1772 // https://github.com/zeit/hyper/pull/1772
_watcher = fs.watchFile(cfgPath, {interval: 2000}, (curr, prev) => { _watcher = fs.watchFile(cfgPath, {interval: 2000}, (curr, prev) => {
if (curr.mtime === 0) { if (!curr.mtime || curr.mtime.getTime() === 0) {
//eslint-disable-next-line no-console //eslint-disable-next-line no-console
console.error('error watching config'); console.error('error watching config');
} else if (curr.mtime !== prev.mtime) { } else if (curr.mtime.getTime() !== prev.mtime.getTime()) {
onChange(); onChange();
} }
}); });