Skip to content

Commit 7279c4e

Browse files
committed
fixed webpack#1650
1 parent c0aebd6 commit 7279c4e

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

lib/HotModuleReplacement.runtime.js

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,40 +29,47 @@ module.exports = function() {
2929
};
3030
for(var name in $require$) {
3131
if(Object.prototype.hasOwnProperty.call($require$, name)) {
32-
Object.defineProperty(fn, name, {
33-
get: function() {
34-
return $require$[name];
35-
},
36-
set: function(value) {
37-
$require$[name] = value;
38-
}
39-
});
32+
Object.defineProperty(fn, name, (function(name) {
33+
return {
34+
configurable: true,
35+
enumerable: true,
36+
get: function() {
37+
return $require$[name];
38+
},
39+
set: function(value) {
40+
$require$[name] = value;
41+
}
42+
};
43+
}(name)));
4044
}
4145
}
42-
fn.e = function(chunkId, callback) {
43-
if(hotStatus === "ready")
44-
hotSetStatus("prepare");
45-
hotChunksLoading++;
46-
$require$.e(chunkId, function() {
47-
try {
48-
callback.call(null, fn);
49-
} finally {
50-
finishChunkLoading();
51-
}
46+
Object.defineProperty(fn, "e", {
47+
enumerable: true,
48+
value: function(chunkId, callback) {
49+
if(hotStatus === "ready")
50+
hotSetStatus("prepare");
51+
hotChunksLoading++;
52+
$require$.e(chunkId, function() {
53+
try {
54+
callback.call(null, fn);
55+
} finally {
56+
finishChunkLoading();
57+
}
5258

53-
function finishChunkLoading() {
54-
hotChunksLoading--;
55-
if(hotStatus === "prepare") {
56-
if(!hotWaitingFilesMap[chunkId]) {
57-
hotEnsureUpdateChunk(chunkId);
58-
}
59-
if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
60-
hotUpdateDownloaded();
59+
function finishChunkLoading() {
60+
hotChunksLoading--;
61+
if(hotStatus === "prepare") {
62+
if(!hotWaitingFilesMap[chunkId]) {
63+
hotEnsureUpdateChunk(chunkId);
64+
}
65+
if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
66+
hotUpdateDownloaded();
67+
}
6168
}
6269
}
6370
}
64-
});
65-
};
71+
}
72+
});
6673
return fn;
6774
}
6875

0 commit comments

Comments
 (0)