From 2414f1b3e0bd21425c356a77f198b2dcbae9c22d 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 82b112e9c..5e189d3b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -423,6 +423,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; }