Skip to content

Commit

Permalink
Set the files found during node_modules search correctly when reusing…
Browse files Browse the repository at this point in the history
… existing program structure

This marks files reused correctly as from external library resulting in not using them for files to be emitted and computed for output structure
Fixes #19327
  • Loading branch information
sheetalkamat committed Oct 24, 2017
1 parent aaaa280 commit 4e56347
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compiler/program.ts
Expand Up @@ -1049,6 +1049,10 @@ namespace ts {
// update fileName -> file mapping
for (let i = 0; i < newSourceFiles.length; i++) {
filesByName.set(filePaths[i], newSourceFiles[i]);
// Set the file as found during node modules search if it was found that way in old progra,
if (oldProgram.isSourceFileFromExternalLibrary(oldProgram.getSourceFileByPath(filePaths[i]))) {
sourceFilesFoundSearchingNodeModules.set(filePaths[i], true);
}
}

files = newSourceFiles;
Expand Down
1 change: 1 addition & 0 deletions src/harness/unittests/tscWatchMode.ts
Expand Up @@ -1927,6 +1927,7 @@ declare module "fs" {
expectedFiles[1].isExpectedToEmit = false;
host.reloadFS(programFiles.concat(configFile));
host.runQueuedTimeoutCallbacks();
checkProgramActualFiles(watch(), programFiles.map(f => f.path));
checkOutputErrors(host, emptyArray);
verifyExpectedFiles(expectedFiles);

Expand Down

0 comments on commit 4e56347

Please sign in to comment.