Skip to content

Commit 9bd6e78

Browse files
authored
Merge pull request #68 from SimulatedGREG/fix-watchRun-issue
[#63] check for compiler.hooks
2 parents 5f75900 + fc2283d commit 9bd6e78

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/virtual.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ function VirtualModulesPlugin(compiler) {
3232
};
3333
}
3434

35-
compiler.hooks.watchRun.tapAsync('VirtualModulesPlugin', (watcher, callback) => {
35+
const watchRunHook = (watcher, callback) => {
3636
this._watcher = watcher.compiler || watcher;
3737
callback();
38-
});
38+
};
39+
40+
if (compiler.hooks) {
41+
compiler.hooks.watchRun.tapAsync('VirtualModulesPlugin', watchRunHook);
42+
} else {
43+
compiler.plugin('watch-run', watchRunHook);
44+
}
3945
}
4046

4147
VirtualModulesPlugin.prototype.writeModule = function(filePath, contents) {

0 commit comments

Comments
 (0)