Skip to content

Commit

Permalink
add parents correctly when creating namespace objects
Browse files Browse the repository at this point in the history
fixes #7477
  • Loading branch information
sokra committed Jun 7, 2018
1 parent 9ac4045 commit b9229fa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/HotModuleReplacement.runtime.js
Expand Up @@ -55,7 +55,8 @@ module.exports = function() {
for (var name in $require$) {
if (
Object.prototype.hasOwnProperty.call($require$, name) &&
name !== "e"
name !== "e" &&
name !== "t"
) {
Object.defineProperty(fn, name, ObjectFactory(name));
}
Expand All @@ -80,6 +81,10 @@ module.exports = function() {
}
}
};
fn.t = function(value, mode) {
if (mode & 1) value = fn(value);
return $require$.t(value, mode & ~1);
};
return fn;
}

Expand Down
3 changes: 3 additions & 0 deletions test/hotCases/runtime/bubble-async/file.js
@@ -0,0 +1,3 @@
module.exports = 1;
---
module.exports = 2;
16 changes: 16 additions & 0 deletions test/hotCases/runtime/bubble-async/index.js
@@ -0,0 +1,16 @@
import { load } from "./parent-file";
import update from "../../update";

it("should bubble update from a nested dependency", () => {
return load().then(value => {
expect(value).toBe(1);
return new Promise((resolve, reject) => {
module.hot.accept("./parent-file", () => {
resolve(load().then(value => {
expect(value).toBe(2);
}));
});
NEXT(update(reject));
});
})
});
3 changes: 3 additions & 0 deletions test/hotCases/runtime/bubble-async/parent-file.js
@@ -0,0 +1,3 @@
export function load() {
return import("./file").then(file => file.default);
}

0 comments on commit b9229fa

Please sign in to comment.