Skip to content

Commit

Permalink
fix: preserve path in references that doesn't target a package root
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Aug 17, 2021
1 parent 98866a5 commit 3f4e151
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2254,7 +2254,9 @@ namespace ts.server {
const getPnpPath = (path: string) => {
try {
const targetLocator = pnpApi.findPackageLocator(`${path}/`);
return pnpApi.resolveToUnqualified(targetLocator.name, `${basePath}/`);
const {packageLocation} = pnpApi.getPackageInformation(targetLocator);
const request = combinePaths(targetLocator.name, getRelativePathFromDirectory(packageLocation, path, false));
return pnpApi.resolveToUnqualified(request, `${basePath}/`);
} catch {
// something went wrong with the resolution, try not to fail
return path;
Expand Down

0 comments on commit 3f4e151

Please sign in to comment.