Created
June 21, 2020 13:24
-
-
Save krizka/f4b315a06b702e63aeea40b135b14722 to your computer and use it in GitHub Desktop.
Meteor patch to disable watch of node_modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: tools/fs/watch.ts | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- tools/fs/watch.ts (revision 9343ce2a3e6cfe88d591b827f826ee3241f66b3b) | |
+++ tools/fs/watch.ts (date 1589406620439) | |
@@ -117,6 +117,8 @@ | |
return; | |
} | |
+ if (filePath.includes('node_modules')) return; | |
+ | |
if (_.has(this.files, filePath)) { | |
// Redundant? | |
if (this.files[filePath] === hash) { | |
@@ -166,6 +168,7 @@ | |
names, | |
contents, | |
}: DirectoryEntry) { | |
+ if (absPath.includes('node_modules')) return; | |
if (this.alwaysFire) return; | |
if (_.isEmpty(include) && _.isEmpty(names)) { | |
return; | |
Index: tools/isobuild/package-source.js | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- tools/isobuild/package-source.js (revision 9343ce2a3e6cfe88d591b827f826ee3241f66b3b) | |
+++ tools/isobuild/package-source.js (date 1589406620441) | |
@@ -834,6 +834,8 @@ | |
}), | |
_readAndWatchDirectory(relDir, watchSet, {include, exclude, names}) { | |
+ if (relDir.includes('node_modules')) return []; | |
+ | |
return watch.readAndWatchDirectory(watchSet, { | |
absPath: files.pathJoin(this.sourceRoot, relDir), | |
include, exclude, names | |
Index: tools/fs/safe-watcher.ts | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- tools/fs/safe-watcher.ts (revision 9343ce2a3e6cfe88d591b827f826ee3241f66b3b) | |
+++ tools/fs/safe-watcher.ts (date 1589407650324) | |
@@ -26,10 +26,10 @@ | |
} | |
var DEFAULT_POLLING_INTERVAL = | |
- +(process.env.METEOR_WATCH_POLLING_INTERVAL_MS || 5000); | |
+ +(process.env.METEOR_WATCH_POLLING_INTERVAL_MS || 10000); | |
var NO_WATCHER_POLLING_INTERVAL = | |
- +(process.env.METEOR_WATCH_POLLING_INTERVAL_MS || 500); | |
+ +(process.env.METEOR_WATCH_POLLING_INTERVAL_MS || 1000); | |
// This may seems like a long time to wait before actually closing the | |
// file watchers, but it's to our advantage if they survive restarts. | |
@@ -390,6 +390,8 @@ | |
export const watch = Profile( | |
"safeWatcher.watch", | |
(absPath: string, callback: EntryCallback) => { | |
+ if (absPath.includes('node_modules')) return { close() {} } as SafeWatcher; | |
+ | |
const entry = acquireWatcher(absPath, callback); | |
return { | |
close() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment