From 379c849d8ebb837cf634ea7cf122a314dd52d49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20V=C3=A1zquez=20P=C3=BAa?= Date: Tue, 4 Jun 2019 15:39:33 +0200 Subject: [PATCH] Increase instance version when new root files are added Fixes #943 --- src/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index.ts b/src/index.ts index 9f7fd1901..7a31e1d84 100644 --- a/src/index.ts +++ b/src/index.ts @@ -421,6 +421,17 @@ function updateFileInCache( instance.changedFilesList = true; } + // instance.version must be increased when a new root file is added. + // + // Note that the file could actually be in the cache if it was found + // as a dependency before. + // + // See https://github.com/TypeStrong/ts-loader/issues/943 + // + if (!instance.rootFileNames.has(filePath)) { + instance.version!++; + } + if (instance.watchHost !== undefined && contents === undefined) { fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Deleted; }