Skip to content

Commit

Permalink
Don't attempt to use find crawler on Windows
Browse files Browse the repository at this point in the history
Summary:
This replicates the [hotfix](3703019) 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: #914

Reviewed By: huntie

Differential Revision: D42371016

fbshipit-source-id: 3bd9c5e5bd42245ada39b314ac2c6301ca4315f4
  • Loading branch information
robhogan authored and facebook-github-bot committed Jan 5, 2023
1 parent b942eca commit 735aa9f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/metro-file-map/src/crawlers/node/index.js
Expand Up @@ -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');
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 735aa9f

Please sign in to comment.