Skip to content

Commit

Permalink
Fixes issue when importer and importee are the same package
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis committed Jun 14, 2020
1 parent 0b42da4 commit 3af06df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/compiler/moduleSpecifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ namespace ts.moduleSpecifiers {
const locator = pnpApi.findPackageLocator(moduleFileName);
// eslint-disable-next-line no-null/no-null
if (locator !== null) {
const sourceLocator = pnpApi.findPackageLocator(`${sourceDirectory}/`);
// Don't use the package name when the imported file is inside
// the source directory (prefer a relative path instead)
if (locator === sourceLocator) {
return undefined;
}
const information = pnpApi.getPackageInformation(locator);
packageName = locator.name;
parts = {
Expand Down

0 comments on commit 3af06df

Please sign in to comment.