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 authored and mansona committed Oct 18, 2023
1 parent d75097a commit 6cf085e
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 @@ -754,7 +754,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 @@ -825,7 +829,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, '..', 'moved-package-target.js')).withMeta({
resolvedWithinPackage: pkg.root,
});
Expand Down Expand Up @@ -1056,14 +1060,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 6cf085e

Please sign in to comment.