Use chooseCanonicalDep to choose the dep when finding a module by name, instead of randomly selecting the first matching dep.
PiperOrigin-RevId: 242199615
diff --git a/ts_auto_deps/analyze/loader.go b/ts_auto_deps/analyze/loader.go
index 90b61fa..4a98600 100644
--- a/ts_auto_deps/analyze/loader.go
+++ b/ts_auto_deps/analyze/loader.go
@@ -246,9 +246,9 @@
// get the file path that corresponds to the normalized typescript import
// path
filePath := labelToPath(label)
- var matchingDeps []*appb.Rule
allRules := pkgToAllRules[pkg]
actualToAlias := pkgToActualToAlias[pkg]
+ var matchingDeps []*appb.Rule
for _, candidate := range typeScriptRules(allRules) {
// check if the rule has the file or the generator of the file in its
// srcs