NodeMainTemplateAsync.runtime.js
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// eslint-disable-next-line no-unused-vars
var $hotChunkFilename$ = undefined;
var $require$ = undefined;
var hotAddUpdateChunk = undefined;
var $hotMainFilename$ = undefined;
var installedChunks = undefined;
module.exports = function() {
// eslint-disable-next-line no-unused-vars
function hotDownloadUpdateChunk(chunkId) {
var filename = require("path").join(__dirname, $hotChunkFilename$);
require("fs").readFile(filename, "utf-8", function(err, content) {
if (err) {
if ($require$.onError) return $require$.oe(err);
throw err;
}
var chunk = {};
require("vm").runInThisContext(
"(function(exports) {" + content + "\n})",
{ filename: filename }
)(chunk);
hotAddUpdateChunk(chunk.id, chunk.modules);
});
}
// eslint-disable-next-line no-unused-vars
function hotDownloadManifest() {
var filename = require("path").join(__dirname, $hotMainFilename$);
return new Promise(function(resolve, reject) {
require("fs").readFile(filename, "utf-8", function(err, content) {
if (err) return resolve();
try {
var update = JSON.parse(content);
} catch (e) {
return reject(e);
}
resolve(update);
});
});
}
// eslint-disable-next-line no-unused-vars
function hotDisposeChunk(chunkId) {
delete installedChunks[chunkId];
}
};