Skip to content

Commit

Permalink
Ensure self-references within dummy apps work for @ resolution syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Apr 7, 2022
1 parent 1d9878e commit 1a09641
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/compat/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,9 @@ export default class CompatResolver implements Resolver {
if (renamed) {
packageName = renamed;
}
return this._tryHelper(parts[1], from, cache.resolve(packageName, cache.ownerOfFile(from)!));
let owner = cache.ownerOfFile(from)!;
let targetPackage = owner.name === packageName ? owner : cache.resolve(packageName, owner);
return this._tryHelper(parts[1], from, targetPackage);
} else {
return this._tryHelper(path, from, this.appPackage);
}
Expand Down Expand Up @@ -501,7 +503,9 @@ export default class CompatResolver implements Resolver {
if (renamed) {
packageName = renamed;
}
return this._tryModifier(parts[1], from, cache.resolve(packageName, cache.ownerOfFile(from)!));
let owner = cache.ownerOfFile(from)!;
let targetPackage = owner.name === packageName ? owner : cache.resolve(packageName, owner);
return this._tryModifier(parts[1], from, targetPackage);
} else {
return this._tryModifier(path, from, this.appPackage);
}
Expand Down Expand Up @@ -540,7 +544,10 @@ export default class CompatResolver implements Resolver {
if (renamed) {
packageName = renamed;
}
return this._tryComponent(parts[1], from, withRuleLookup, cache.resolve(packageName, cache.ownerOfFile(from)!));
let owner = cache.ownerOfFile(from)!;
let targetPackage = owner.name === packageName ? owner : cache.resolve(packageName, owner);

return this._tryComponent(parts[1], from, withRuleLookup, targetPackage);
} else {
return this._tryComponent(path, from, withRuleLookup, this.appPackage);
}
Expand Down

0 comments on commit 1a09641

Please sign in to comment.