Skip to content

Commit af348cd

Browse files
committed
fixed webpack#1650
1 parent c0420f1 commit af348cd

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/HotModuleReplacement.runtime.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ module.exports = function() {
2929
};
3030
for(var name in $require$) {
3131
if(Object.prototype.hasOwnProperty.call($require$, name)) {
32-
fn[name] = $require$[name];
32+
Object.defineProperty(fn, name, {
33+
get: function() { return $require$[name]; },
34+
set: function(value) { $require$[name] = value; }
35+
});
3336
}
3437
}
3538
fn.e = function(chunkId, callback) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__webpack_public_path__ = "ok";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
it("should be able to set the public path globally", function() {
2+
var org = __webpack_public_path__;
3+
require("./file");
4+
__webpack_public_path__.should.be.eql("ok");
5+
__webpack_public_path__ = org;
6+
});

0 commit comments

Comments
 (0)