diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 7a98c43dd04..ff21c750089 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -749,6 +749,9 @@ namespace ts { (missingFilePathsRequestedForRelease || (missingFilePathsRequestedForRelease = [])).push(oldSourceFile.path); } else if ((hostSourceFileInfo as FilePresentOnHost).sourceFile === oldSourceFile) { + if ((hostSourceFileInfo as FilePresentOnHost).fileWatcher) { + (hostSourceFileInfo as FilePresentOnHost).fileWatcher.close(); + } sourceFilesCache.delete(oldSourceFile.path); resolutionCache.removeResolutionsOfFile(oldSourceFile.path); }