fix(js): throw better error messaging when a dependency is not in the graph (#16510)

This commit is contained in:
Craigory Coppola 2023-04-24 16:50:11 -04:00 committed by GitHub
parent 9aa355f8dc
commit db324007b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,7 +226,7 @@ function findAllNpmDeps(
seen.add(dep);
npmDeps.dependencies[node.data.packageName] = node.data.version;
recursivelyCollectPeerDependencies(node.name, graph, npmDeps, seen);
} else {
} else if (graph.nodes[dep]) {
findAllNpmDeps(
graph.nodes[dep],
graph,
@ -234,6 +234,8 @@ function findAllNpmDeps(
seen,
dependencyPatterns
);
} else {
throw new Error(`Could not find ${dep} in the project graph.`);
}
}
}