We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b42da4 commit 3af06dfCopy full SHA for 3af06df
src/compiler/moduleSpecifiers.ts
@@ -332,6 +332,12 @@ namespace ts.moduleSpecifiers {
332
const locator = pnpApi.findPackageLocator(moduleFileName);
333
// eslint-disable-next-line no-null/no-null
334
if (locator !== null) {
335
+ const sourceLocator = pnpApi.findPackageLocator(`${sourceDirectory}/`);
336
+ // Don't use the package name when the imported file is inside
337
+ // the source directory (prefer a relative path instead)
338
+ if (locator === sourceLocator) {
339
+ return undefined;
340
+ }
341
const information = pnpApi.getPackageInformation(locator);
342
packageName = locator.name;
343
parts = {
0 commit comments