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.
This commit is contained in:
Ben Newman
2017-10-09 12:19:17 -04:00
parent da9dac4bfc
commit 0679e7a8bf

View File

@@ -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