Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit f0bcf43

Browse files
committed
feat(*): watch fixes, refs #129
1 parent 490c0f1 commit f0bcf43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/instance.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ export function ensureInstance(webpack: IWebPack, options: ICompilerOptions, ins
273273
};
274274
}
275275

276+
let EXTENSIONS = /\.tsx?$|\.jsx?$/;
277+
276278
function setupWatchRun(compiler, instanceName: string) {
277279
compiler.plugin('watch-run', async function (watching, callback) {
278280
let compiler: ICompiler = watching.compiler;
@@ -293,9 +295,11 @@ function setupWatchRun(compiler, instanceName: string) {
293295

294296
try {
295297
let tasks = changedFiles.map(async function(changedFile) {
296-
if (/\.ts$|\.d\.ts$|\.tsx$|\.js$|\.jsx$/.test(changedFile)) {
297-
await state.readFileAndUpdate(changedFile);
298-
await state.fileAnalyzer.checkDependencies(resolver, changedFile);
298+
if (EXTENSIONS.test(changedFile)) {
299+
if (state.hasFile(changedFile)) {
300+
await state.readFileAndUpdate(changedFile);
301+
await state.fileAnalyzer.checkDependencies(resolver, changedFile);
302+
}
299303
}
300304
});
301305

0 commit comments

Comments
 (0)