Skip to content

Commit

Permalink
implement reversing of the resolvedWithinPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 authored and mansona committed Oct 11, 2023
1 parent 896c012 commit baf04ed
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/core/src/module-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,9 @@ export class Resolver {
return request.rehome(resolve(pkg.root, 'package.json'));
} else {
// otherwise we need to just assume that internal naming is simple
return request.rehome(resolve(pkg.root, '..', 'superFakeTarget.js'));
return request.rehome(resolve(pkg.root, '..', 'superFakeTarget.js')).withMeta({
resolvedWithinPackage: pkg.root,
});
}
}

Expand Down Expand Up @@ -1000,6 +1002,13 @@ export class Resolver {
return request;
}

if (fromFile.endsWith('superFakeTarget.js')) {
if (!request.meta?.resolvedWithinPackage) {
throw new Error(`bug: embroider resolver's meta is not propagating`);
}
fromFile = resolve(request.meta?.resolvedWithinPackage as string, 'package.json');
}

let pkg = this.packageCache.ownerOfFile(fromFile);
if (!pkg) {
return logTransition('no identifiable owningPackage', request);
Expand Down

0 comments on commit baf04ed

Please sign in to comment.