UNPKG

3.46 kBJavaScriptView Raw
1module.exports =
2/******/ (function() { // webpackBootstrap
3/******/ "use strict";
4/******/ var __webpack_modules__ = ({
5
6/***/ 949:
7/***/ (function(__unused_webpack_module, exports) {
8
9var __resourceQuery = "";
10/* global __resourceQuery */
11
12
13
14if (typeof EventSource !== "function") {
15 throw new Error(
16 "Environment doesn't support lazy compilation (requires EventSource)"
17 );
18}
19
20var urlBase = decodeURIComponent(__resourceQuery.slice(1));
21var activeEventSource;
22var activeKeys = new Map();
23var errorHandlers = new Set();
24
25var updateEventSource = function updateEventSource() {
26 if (activeEventSource) activeEventSource.close();
27 if (activeKeys.size) {
28 activeEventSource = new EventSource(
29 urlBase + Array.from(activeKeys.keys()).join("@")
30 );
31 activeEventSource.onerror = function (event) {
32 errorHandlers.forEach(function (onError) {
33 onError(
34 new Error(
35 "Problem communicating active modules to the server: " +
36 event.message +
37 " " +
38 event.filename +
39 ":" +
40 event.lineno +
41 ":" +
42 event.colno +
43 " " +
44 event.error
45 )
46 );
47 });
48 };
49 } else {
50 activeEventSource = undefined;
51 }
52};
53
54exports.keepAlive = function (options) {
55 var data = options.data;
56 var onError = options.onError;
57 var active = options.active;
58 var module = options.module;
59 errorHandlers.add(onError);
60 var value = activeKeys.get(data) || 0;
61 activeKeys.set(data, value + 1);
62 if (value === 0) {
63 updateEventSource();
64 }
65 if (!active && !module.hot) {
66 console.log(
67 "Hot Module Replacement is not enabled. Waiting for process restart..."
68 );
69 }
70
71 return function () {
72 errorHandlers.delete(onError);
73 setTimeout(function () {
74 var value = activeKeys.get(data);
75 if (value === 1) {
76 activeKeys.delete(data);
77 updateEventSource();
78 } else {
79 activeKeys.set(data, value - 1);
80 }
81 }, 1000);
82 };
83};
84
85
86/***/ })
87
88/******/ });
89/************************************************************************/
90/******/ // The module cache
91/******/ var __webpack_module_cache__ = {};
92/******/
93/******/ // The require function
94/******/ function __nccwpck_require__(moduleId) {
95/******/ // Check if module is in cache
96/******/ if(__webpack_module_cache__[moduleId]) {
97/******/ return __webpack_module_cache__[moduleId].exports;
98/******/ }
99/******/ // Create a new module (and put it into the cache)
100/******/ var module = __webpack_module_cache__[moduleId] = {
101/******/ // no module.id needed
102/******/ // no module.loaded needed
103/******/ exports: {}
104/******/ };
105/******/
106/******/ // Execute the module function
107/******/ var threw = true;
108/******/ try {
109/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
110/******/ threw = false;
111/******/ } finally {
112/******/ if(threw) delete __webpack_module_cache__[moduleId];
113/******/ }
114/******/
115/******/ // Return the exports of the module
116/******/ return module.exports;
117/******/ }
118/******/
119/************************************************************************/
120/******/ /* webpack/runtime/compat */
121/******/
122/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
123/******/ // module exports must be returned from runtime so entry inlining is disabled
124/******/ // startup
125/******/ // Load entry module and return exports
126/******/ return __nccwpck_require__(949);
127/******/ })()
128;
\No newline at end of file