From 6d18701d6a29631bb67be545272acffd59a89c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Thu, 18 Oct 2018 02:54:28 -0700 Subject: [PATCH] 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 --- package.json | 3 ++- static/compilePlugins.js | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e9228a729..58dc8a51d 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ }, "win": { "publisherName": "Facebook, Inc." - } + }, + "asar": false }, "resolutions": { "@jest-runner/electron/electron": "3.0.0" diff --git a/static/compilePlugins.js b/static/compilePlugins.js index 3303b5c39..8b0f6bcf7 100644 --- a/static/compilePlugins.js +++ b/static/compilePlugins.js @@ -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); + } }), ); }