source: trip-planner-front/node_modules/webpack/hot/only-dev-server.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.5 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 var lastHash;
8 var upToDate = function upToDate() {
9 return lastHash.indexOf(__webpack_hash__) >= 0;
10 };
11 var log = require("./log");
12 var check = function check() {
13 module.hot
14 .check()
15 .then(function (updatedModules) {
16 if (!updatedModules) {
17 log("warning", "[HMR] Cannot find update. Need to do a full reload!");
18 log(
19 "warning",
20 "[HMR] (Probably because of restarting the webpack-dev-server)"
21 );
22 return;
23 }
24
25 return module.hot
26 .apply({
27 ignoreUnaccepted: true,
28 ignoreDeclined: true,
29 ignoreErrored: true,
30 onUnaccepted: function (data) {
31 log(
32 "warning",
33 "Ignored an update to unaccepted module " +
34 data.chain.join(" -> ")
35 );
36 },
37 onDeclined: function (data) {
38 log(
39 "warning",
40 "Ignored an update to declined module " +
41 data.chain.join(" -> ")
42 );
43 },
44 onErrored: function (data) {
45 log("error", data.error);
46 log(
47 "warning",
48 "Ignored an error while updating module " +
49 data.moduleId +
50 " (" +
51 data.type +
52 ")"
53 );
54 }
55 })
56 .then(function (renewedModules) {
57 if (!upToDate()) {
58 check();
59 }
60
61 require("./log-apply-result")(updatedModules, renewedModules);
62
63 if (upToDate()) {
64 log("info", "[HMR] App is up to date.");
65 }
66 });
67 })
68 .catch(function (err) {
69 var status = module.hot.status();
70 if (["abort", "fail"].indexOf(status) >= 0) {
71 log(
72 "warning",
73 "[HMR] Cannot check for update. Need to do a full reload!"
74 );
75 log("warning", "[HMR] " + log.formatError(err));
76 } else {
77 log("warning", "[HMR] Update check failed: " + log.formatError(err));
78 }
79 });
80 };
81 var hotEmitter = require("./emitter");
82 hotEmitter.on("webpackHotUpdate", function (currentHash) {
83 lastHash = currentHash;
84 if (!upToDate()) {
85 var status = module.hot.status();
86 if (status === "idle") {
87 log("info", "[HMR] Checking for updates on the server...");
88 check();
89 } else if (["abort", "fail"].indexOf(status) >= 0) {
90 log(
91 "warning",
92 "[HMR] Cannot apply update as a previous update " +
93 status +
94 "ed. Need to do a full reload!"
95 );
96 }
97 }
98 });
99 log("info", "[HMR] Waiting for update signal from WDS...");
100} else {
101 throw new Error("[HMR] Hot Module Replacement is disabled.");
102}
Note: See TracBrowser for help on using the repository browser.