source: imaps-frontend/node_modules/webpack/hot/only-dev-server.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5/* globals __webpack_hash__ */
6if (module.hot) {
7 /** @type {undefined|string} */
8 var lastHash;
9 var upToDate = function upToDate() {
10 return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
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();
71 if (["abort", "fail"].indexOf(status) >= 0) {
72 log(
73 "warning",
74 "[HMR] Cannot check for update. Need to do a full reload!"
75 );
76 log("warning", "[HMR] " + log.formatError(err));
77 } else {
78 log("warning", "[HMR] Update check failed: " + log.formatError(err));
79 }
80 });
81 };
82 var hotEmitter = require("./emitter");
83 hotEmitter.on("webpackHotUpdate", function (currentHash) {
84 lastHash = currentHash;
85 if (!upToDate()) {
86 var status = module.hot.status();
87 if (status === "idle") {
88 log("info", "[HMR] Checking for updates on the server...");
89 check();
90 } else if (["abort", "fail"].indexOf(status) >= 0) {
91 log(
92 "warning",
93 "[HMR] Cannot apply update as a previous update " +
94 status +
95 "ed. Need to do a full reload!"
96 );
97 }
98 }
99 });
100 log("info", "[HMR] Waiting for update signal from WDS...");
101} else {
102 throw new Error("[HMR] Hot Module Replacement is disabled.");
103}
Note: See TracBrowser for help on using the repository browser.