| 11 | }; |
| 12 | var log = require("./log"); |
| 13 | var check = function check() { |
| 14 | module.hot |
| 15 | .check() |
| 16 | .then(function (updatedModules) { |
| 17 | if (!updatedModules) { |
| 18 | log("warning", "[HMR] Cannot find update. Need to do a full reload!"); |
| 19 | log( |
| 20 | "warning", |
| 21 | "[HMR] (Probably because of restarting the webpack-dev-server)" |
| 22 | ); |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | return module.hot |
| 27 | .apply({ |
| 28 | ignoreUnaccepted: true, |
| 29 | ignoreDeclined: true, |
| 30 | ignoreErrored: true, |
| 31 | onUnaccepted: function (data) { |
| 32 | log( |
| 33 | "warning", |
| 34 | "Ignored an update to unaccepted module " + |
| 35 | data.chain.join(" -> ") |
| 36 | ); |
| 37 | }, |
| 38 | onDeclined: function (data) { |
| 39 | log( |
| 40 | "warning", |
| 41 | "Ignored an update to declined module " + |
| 42 | data.chain.join(" -> ") |
| 43 | ); |
| 44 | }, |
| 45 | onErrored: function (data) { |
| 46 | log("error", data.error); |
| 47 | log( |
| 48 | "warning", |
| 49 | "Ignored an error while updating module " + |
| 50 | data.moduleId + |
| 51 | " (" + |
| 52 | data.type + |
| 53 | ")" |
| 54 | ); |
| 55 | } |
| 56 | }) |
| 57 | .then(function (renewedModules) { |
| 58 | if (!upToDate()) { |
| 59 | check(); |
| 60 | } |
| 61 | |
| 62 | require("./log-apply-result")(updatedModules, renewedModules); |
| 63 | |
| 64 | if (upToDate()) { |
| 65 | log("info", "[HMR] App is up to date."); |
| 66 | } |
| 67 | }); |
| 68 | }) |
| 69 | .catch(function (err) { |
| 70 | var status = module.hot.status(); |