Fix only-dev-server.js's module.hot.apply call

It had not been updated to webpack 2's Promise ways, so the callback
never happened.
This commit is contained in:
Diogo Franco (Kovensky) 2016-06-16 00:08:33 +09:00
parent 8e22c6b92e
commit 621d656573
1 changed files with 11 additions and 14 deletions

View File

@ -18,20 +18,7 @@ if(module.hot) {
module.hot.apply({
ignoreUnaccepted: true
}, function(err, renewedModules) {
if(err) {
if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update. Need to do a full reload!");
console.warn("[HMR] " + err.stack || err.message);
} else {
console.warn("[HMR] Update failed: " + err.stack || err.message);
}
return;
}
}).then(function(renewedModules) {
if(!upToDate()) {
check();
}
@ -41,6 +28,16 @@ if(module.hot) {
if(upToDate()) {
console.log("[HMR] App is up to date.");
}
}).catch(function(err) {
if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update. Need to do a full reload!");
console.warn("[HMR] " + err.stack || err.message);
} else {
console.warn("[HMR] Update failed: " + err.stack || err.message);
}
});
}).catch(function(err) {
if(module.hot.status() in {