Skip to content

Commit 40b93b9

Browse files
committed
fix: properly close the watcher after tests
1 parent a81dc0f commit 40b93b9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/pluginWebpack4.ts

+9
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,15 @@ class VueLoaderPlugin {
171171
watcher.close()
172172
}
173173
})
174+
175+
// In some cases, e.g. in this project's tests,
176+
// even though needsHMR() returns true, webpack is not watching, thus no watchClose hook is called.
177+
// So we need to close the watcher when webpack is done.
178+
compiler.hooks.done.tap(id, () => {
179+
if (watcher) {
180+
watcher.close()
181+
}
182+
})
174183
}
175184
}
176185
}

0 commit comments

Comments
 (0)