Skip to content

Commit

Permalink
Merge pull request #288 from qazbnm456/master
Browse files Browse the repository at this point in the history
Replace 'compile' with 'invalid' hook.
  • Loading branch information
glenjamin committed Mar 2, 2018
2 parents ae79f6a + 5e7112f commit 6b756cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions middleware.js
Expand Up @@ -13,13 +13,13 @@ function webpackHotMiddleware(compiler, opts) {
var latestStats = null;

if (compiler.hooks) {
compiler.hooks.compile.tap("webpack-hot-middleware", onCompile);
compiler.hooks.invalid.tap("webpack-hot-middleware", onInvalid);
compiler.hooks.done.tap("webpack-hot-middleware", onDone);
} else {
compiler.plugin("compile", onCompile);
compiler.plugin("invalid", onInvalid);
compiler.plugin("done", onDone);
}
function onCompile() {
function onInvalid() {
latestStats = null;
if (opts.log) opts.log("webpack building...");
eventStream.publish({action: "building"});
Expand Down
4 changes: 2 additions & 2 deletions test/middleware-test.js
Expand Up @@ -51,7 +51,7 @@ describe("middleware", function() {

res.on('data', verify);

compiler.emit("compile");
compiler.emit("invalid");

function verify() {
assert.equal(res.events.length, 1);
Expand Down Expand Up @@ -156,7 +156,7 @@ describe("middleware", function() {
function when() {
if (++when.n < 2) return;

compiler.emit("compile");
compiler.emit("invalid");
}

// Finish test when both requests report data
Expand Down

0 comments on commit 6b756cc

Please sign in to comment.