Skip to content

Commit

Permalink
attempting to remove activeAddons self-import for v2 addons
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Oct 17, 2023
1 parent ceb6b25 commit e9d72b1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/core/src/module-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,11 @@ export class Resolver {
// was moved. RewrittenPackageCache.resolve already took care of finding
// the right target, and we redirect the request so it will look inside
// that target.
return logTransition('request targets a moved package', request, this.resolveWithinPackage(request, targetPkg));
return logTransition(
'request targets a moved package',
request,
this.resolveWithinMovedPackage(request, targetPkg)
);
} else if (originalRequestingPkg !== requestingPkg) {
// in this case, the requesting package is moved but its destination is
// not, so we need to rehome the request back to the original location.
Expand Down Expand Up @@ -829,7 +833,7 @@ export class Resolver {
return request;
}

private resolveWithinPackage<R extends ModuleRequest>(request: R, pkg: Package): R {
private resolveWithinMovedPackage<R extends ModuleRequest>(request: R, pkg: Package): R {
return request.rehome(resolve(pkg.root, '..', 'superFakeTarget.js')).withMeta({
resolvedWithinPackage: pkg.root,
});
Expand Down Expand Up @@ -1060,14 +1064,11 @@ export class Resolver {
}

// auto-upgraded packages can fall back to the set of known active addons
//
// v2 packages can fall back to the set of known active addons only to find
// themselves (which is needed due to app tree merging)
if ((pkg.meta['auto-upgraded'] || packageName === pkg.name) && this.options.activeAddons[packageName]) {
if (pkg.meta['auto-upgraded'] && this.options.activeAddons[packageName]) {
return logTransition(
`activeAddons`,
request,
this.resolveWithinPackage(request, this.packageCache.get(this.options.activeAddons[packageName]))
this.resolveWithinMovedPackage(request, this.packageCache.get(this.options.activeAddons[packageName]))
);
}

Expand Down

0 comments on commit e9d72b1

Please sign in to comment.