Skip to content

Commit 258b0c1

Browse files
committed
fixed single option
1 parent f265d3e commit 258b0c1

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

bin/webpack.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ var argv = require("optimist")
3333
.describe("colors", "Output Stats with colors")
3434
.default("colors", false)
3535

36+
.boolean("single")
37+
.describe("single", "Disable lazy loading")
38+
.default("single", false)
39+
3640
.boolean("json")
3741
.describe("json", "Output Stats as JSON")
3842
.default("json", false)
@@ -95,6 +99,10 @@ if(argv.debug) {
9599
options.debug = true;
96100
}
97101

102+
if(argv.single) {
103+
options.single = true;
104+
}
105+
98106
if(argv.watch) {
99107
options.watch = true;
100108
}

lib/buildDeps.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -477,15 +477,19 @@ function addModuleToChunk(depTree, context, chunkId, options) {
477477
}
478478
if(context.asyncs) {
479479
context.asyncs.forEach(function(context) {
480-
var subChunk
481-
if(context.chunkId) {
482-
subChunk = depTree.chunks[context.chunkId];
483-
subChunk.usages++;
480+
if(options.single) {
481+
addModuleToChunk(depTree, context, chunkId, options);
484482
} else {
485-
subChunk = addChunk(depTree, context, options);
483+
var subChunk;
484+
if(context.chunkId) {
485+
subChunk = depTree.chunks[context.chunkId];
486+
subChunk.usages++;
487+
} else {
488+
subChunk = addChunk(depTree, context, options);
489+
}
490+
subChunk.parents = subChunk.parents || [];
491+
subChunk.parents.push(chunkId);
486492
}
487-
subChunk.parents = subChunk.parents || [];
488-
subChunk.parents.push(chunkId);
489493
});
490494
}
491495
}

0 commit comments

Comments
 (0)