We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7f42747 commit 6ce39c2Copy full SHA for 6ce39c2
src/compiler/moduleSpecifiers.ts
@@ -307,6 +307,12 @@ namespace ts.moduleSpecifiers {
307
const locator = pnpApi.findPackageLocator(moduleFileName);
308
// eslint-disable-next-line no-null/no-null
309
if (locator !== null) {
310
+ const sourceLocator = pnpApi.findPackageLocator(`${sourceDirectory}/`);
311
+ // Don't use the package name when the imported file is inside
312
+ // the source directory (prefer a relative path instead)
313
+ if (locator === sourceLocator) {
314
+ return undefined;
315
+ }
316
const information = pnpApi.getPackageInformation(locator);
317
packageName = locator.name;
318
parts = {
0 commit comments