Skip to content

Commit c46e3e8

Browse files
committed
fixed System.import context
fixed webpack#2490
1 parent dc3bd05 commit c46e3e8

5 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎lib/ContextModule.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ ContextModule.prototype.build = function(options, compilation, resolver, fs, cal
8282
if(this.async) {
8383
this.blocks = dependencies && dependencies.map(function(dep) {
8484
var block = new DependenciesBlock();
85+
block.parent = this;
8586
block.dependencies = [dep];
8687
return block;
87-
});
88+
}, this);
8889
} else {
8990
this.dependencies = dependencies;
9091
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { value } from "./file";
2+
module.hot.accept("./file");
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { value } from "./file";
2+
module.hot.accept("./file");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export var value = 1;
2+
---
3+
export var value = 2;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
it("should import a changed chunk (dynamic import)", function(done) {
2+
function load(name) {
3+
return System.import("./chunk" + name);
4+
}
5+
load(1).then(function(chunk) {
6+
chunk.value.should.be.eql(1);
7+
NEXT(require("../../update")(done));
8+
setTimeout(function() {
9+
chunk.value.should.be.eql(2);
10+
load(2).then(function(chunk2) {
11+
chunk2.value.should.be.eql(2);
12+
done();
13+
}).catch(done);
14+
}, 100);
15+
}).catch(done);
16+
});

0 commit comments

Comments
 (0)