disable ASAR

Summary:
Metro's new version using `jest-haste-map` wants to access files inside our ASAR bundle, not using electron's require function. This fails, because it can not read from inside the ASAR bundle. For this reason we are disabeling ASAR for now.

Additionally, we are disabling reloads when a hidden file changes. This is because watchman creates a `.watchman-cookie` which shoudln't triggers a reload. But in general I think it's safe to not reload when hidden files are changed, as they are unlikely to have actual code in them.

Reviewed By: passy

Differential Revision: D10426715

fbshipit-source-id: 6ad9dcf88c62d5b65a9736eff28aadaf89c6af7a
This commit is contained in:
Daniel Büchele
2018-10-18 02:54:28 -07:00
committed by Facebook Github Bot
parent f973bdd455
commit 6d18701d6a
2 changed files with 9 additions and 4 deletions

View File

@@ -19,7 +19,8 @@
},
"win": {
"publisherName": "Facebook, Inc."
}
},
"asar": false
},
"resolutions": {
"@jest-runner/electron/electron": "3.0.0"

View File

@@ -35,9 +35,13 @@ function watchChanges(plugins, reloadCallback, pluginCache) {
Object.values(plugins).map(plugin =>
fs.watch(plugin.rootDir, (eventType, filename) => {
// eslint-disable-next-line no-console
console.log(`🕵️‍ Detected changes in ${plugin.name}`);
compilePlugin(plugin, true, pluginCache).then(reloadCallback);
// only recompile for changes in not hidden files. Watchman might create
// a file called .watchman-cookie
if (!filename.startsWith('.')) {
// eslint-disable-next-line no-console
console.log(`🕵️‍ Detected changes in ${plugin.name}`);
compilePlugin(plugin, true, pluginCache).then(reloadCallback);
}
}),
);
}