From 735aa9f5233e4cce78f93e94e80a3be509eea72c Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Thu, 5 Jan 2023 14:10:04 -0800 Subject: [PATCH] Don't attempt to use `find` crawler on Windows Summary: This replicates the [hotfix](https://github.com/facebook/metro/commit/370301981b8e5a92e072e5a2323e9be3308a2cdf) released in 0.73.7, to address an issue whereby Metro would fail to crawl files on Windows for non-Watchman MinGW users. A more substantial fix should follow - IMO, we should remove this `find` crawler completely unless it's more performant in some circumstance. This diff just brings in the quick, least-intrusive fix to get `main` up to parity with `0.73.x`. Closes: https://github.com/facebook/metro/issues/914 Reviewed By: huntie Differential Revision: D42371016 fbshipit-source-id: 3bd9c5e5bd42245ada39b314ac2c6301ca4315f4 --- packages/metro-file-map/src/crawlers/node/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/metro-file-map/src/crawlers/node/index.js b/packages/metro-file-map/src/crawlers/node/index.js index 7923b253af..ff42ef7f07 100644 --- a/packages/metro-file-map/src/crawlers/node/index.js +++ b/packages/metro-file-map/src/crawlers/node/index.js @@ -17,6 +17,7 @@ import H from '../../constants'; import * as fastPath from '../../lib/fast_path'; import {spawn} from 'child_process'; import * as fs from 'graceful-fs'; +import {platform} from 'os'; import * as path from 'path'; const debug = require('debug')('Metro:NodeCrawler'); @@ -177,7 +178,9 @@ module.exports = async function nodeCrawl(options: CrawlerOptions): Promise<{ } = options; perfLogger?.point('nodeCrawl_start'); const useNativeFind = - !forceNodeFilesystemAPI && (await hasNativeFindSupport()); + !forceNodeFilesystemAPI && + platform() !== 'win32' && + (await hasNativeFindSupport()); debug('Using system find: %s', useNativeFind);