Revert D79993649 (#53217)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53217
Changelog: [Internal]
Fix rn-tester jobs

This diff reverts D79993649
(The context such as a Sandcastle job, Task, SEV, etc. was not provided.)

Depends on D79993649

Reviewed By: cortinico

Differential Revision: D80030502

fbshipit-source-id: 1feee2e2ae6a1edbeb755687aecb2a25d9759a90
This commit is contained in:
generatedunixname89002005232357
2025-08-11 15:39:00 -07:00
committed by Facebook GitHub Bot
parent cc71f9c550
commit 677ee671d0
@@ -204,27 +204,8 @@ function findExternalLibraries(
paths: [projectRoot],
});
} catch (e) {
// require.resolve fails if the dependency is a local node module.
if (
// require.resolve fails if the `./package.json` subpath is not explicitly defined in the library's `exports` field in its package.json
'code' in e &&
e.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED'
) {
// find the closest library's package.json with the search paths
// $FlowFixMe[prop-missing]
const paths: Array<string> = require.main.paths;
for (const nodeModulesPath of paths) {
const packageJsonFilePath = path.join(
nodeModulesPath,
dependency,
'package.json',
);
if (fs.existsSync(packageJsonFilePath)) {
configFilePath = packageJsonFilePath;
break;
}
}
} else if (
// require.resolve fails if the dependency is a local node module.
dependencies[dependency].startsWith('.') || // handles relative paths
dependencies[dependency].startsWith('/') // handles absolute paths
) {
@@ -233,9 +214,7 @@ function findExternalLibraries(
pkgJson.dependencies[dependency],
'package.json',
);
}
if (!configFilePath) {
} else {
return [];
}
}