From 0679e7a8bf796fdefef2fa8fd13685b8edf40a90 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Mon, 9 Oct 2017 12:19:17 -0400 Subject: [PATCH] Enable native file watching on Windows unless explicitly disabled. Native file watching is notoriously unreliable on several Windows file systems (e.g. NTFS, since network file systems have trouble supporting change notifications). However, disabling native file watching for all Windows developers was probably a step too far, since it *could* work just fine, and we still have the fs.watchFile-based safety net, which no longer hogs idle CPU cycles for unchanged files. You can explicitly disable native file watching and use polling instead by setting METEOR_WATCH_FORCE_POLLING to a truthy value. Should help with #9175. --- tools/fs/safe-watcher.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/fs/safe-watcher.js b/tools/fs/safe-watcher.js index 7c6435b641..d15ca2d4b3 100644 --- a/tools/fs/safe-watcher.js +++ b/tools/fs/safe-watcher.js @@ -12,11 +12,9 @@ import { // Set METEOR_WATCH_FORCE_POLLING environment variable to a truthy value to // force the use of files.watchFile instead of watchLibrary.watch. -// Enabled on Mac and Linux and disabled on Windows by default. -var WATCHER_ENABLED = ! process.env.METEOR_WATCH_FORCE_POLLING; -if (process.platform === "win32") { - WATCHER_ENABLED = false; -} +var WATCHER_ENABLED = ! JSON.parse( + process.env.METEOR_WATCH_FORCE_POLLING || "false" +); // Default to prioritizing changed files, but disable that behavior (and // thus prioritize all files equally) if METEOR_WATCH_PRIORITIZE_CHANGED