From 677ee671d07d7e1db5b63aebdaef1bc641e6fc03 Mon Sep 17 00:00:00 2001 From: generatedunixname89002005232357 Date: Mon, 11 Aug 2025 15:39:00 -0700 Subject: [PATCH] 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 --- .../generate-artifacts-executor/utils.js | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js b/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js index 4da3fe379c4..e217b99fcb0 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js @@ -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 = 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 []; } }