Skip to content

Commit 93f3813

Browse files
committed
fixed webpack#2443
1 parent 75b93a1 commit 93f3813

5 files changed

Lines changed: 26 additions & 2 deletions

File tree

lib/ContextModule.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ ContextModule.prototype.source = function() {
136136
return a.userRequest < b.userRequest ? -1 : 1;
137137
}).forEach(function(item) {
138138
if(item.dependency.module) {
139-
if(item.block.chunks.length > 1)
139+
var chunks = item.block.chunks || [];
140+
if(chunks.length !== 1)
140141
hasMultipleChunks = true;
141-
map[item.userRequest] = [item.dependency.module.id].concat(item.block.chunks.map(function(chunk) {
142+
map[item.userRequest] = [item.dependency.module.id].concat(chunks.map(function(chunk) {
142143
return chunk.id;
143144
}));
144145
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 1;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 3;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 2;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
it("should be able to use expressions in System.import (directory)", function(done) {
2+
function load(name, expected, callback) {
3+
System.import("./dir/" + name + "/file.js").then(function(result) {
4+
result.should.be.eql(expected);
5+
callback();
6+
}).catch(function(err) {
7+
done(err);
8+
});
9+
}
10+
require.include("./dir/three/file");
11+
load("one", 1, function() {
12+
load("two", 2, function() {
13+
load("three", 3, function() {
14+
load("two", 2, function() {
15+
done();
16+
});
17+
});
18+
});
19+
});
20+
});

0 commit comments

Comments
 (0)