Skip to content

Commit a2dcdd4

Browse files
Dark Knightfacebook-github-bot
authored andcommitted
Revert D79993649
Summary: This diff reverts D79993649 (The context such as a Sandcastle job, Task, SEV, etc. was not provided.) Depends on D79993649 Differential Revision: D80030502
1 parent a2eb3b2 commit a2dcdd4

1 file changed

Lines changed: 2 additions & 23 deletions

File tree

  • packages/react-native/scripts/codegen/generate-artifacts-executor

packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,8 @@ function findExternalLibraries(
204204
paths: [projectRoot],
205205
});
206206
} catch (e) {
207+
// require.resolve fails if the dependency is a local node module.
207208
if (
208-
// require.resolve fails if the `./package.json` subpath is not explicitly defined in the library's `exports` field in its package.json
209-
'code' in e &&
210-
e.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED'
211-
) {
212-
// find the closest library's package.json with the search paths
213-
// $FlowFixMe[prop-missing]
214-
const paths: Array<string> = require.main.paths;
215-
for (const nodeModulesPath of paths) {
216-
const packageJsonFilePath = path.join(
217-
nodeModulesPath,
218-
dependency,
219-
'package.json',
220-
);
221-
if (fs.existsSync(packageJsonFilePath)) {
222-
configFilePath = packageJsonFilePath;
223-
break;
224-
}
225-
}
226-
} else if (
227-
// require.resolve fails if the dependency is a local node module.
228209
dependencies[dependency].startsWith('.') || // handles relative paths
229210
dependencies[dependency].startsWith('/') // handles absolute paths
230211
) {
@@ -233,9 +214,7 @@ function findExternalLibraries(
233214
pkgJson.dependencies[dependency],
234215
'package.json',
235216
);
236-
}
237-
238-
if (!configFilePath) {
217+
} else {
239218
return [];
240219
}
241220
}

0 commit comments

Comments
 (0)