Skip to content

Commit 8c04540

Browse files
authored
Merge pull request #21281 from Microsoft/isEmittedFileCheckInInvalidateResolution
Check if the file added is emitted file after validating extensions
2 parents dcfd634 + 96ac5aa commit 8c04540

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/compiler/resolutionCache.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,6 @@ namespace ts {
473473
resolutionHost.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
474474
}
475475

476-
// Ignore emits from the program
477-
if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectory)) {
478-
return;
479-
}
480-
481476
// If the files are added to project root or node_modules directory, always run through the invalidation process
482477
// Otherwise run through invalidation only if adding to the immediate directory
483478
if (!allFilesHaveInvalidatedResolution &&
@@ -581,6 +576,10 @@ namespace ts {
581576
if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
582577
return false;
583578
}
579+
// Ignore emits from the program
580+
if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
581+
return false;
582+
}
584583
// Resolution need to be invalidated if failed lookup location is same as the file or directory getting created
585584
isChangedFailedLookupLocation = location => resolutionHost.toPath(location) === fileOrDirectoryPath;
586585
}

0 commit comments

Comments
 (0)