fixed single option

This commit is contained in:
Tobias Koppers 2012-06-29 20:54:24 +02:00
parent f265d3e3de
commit 258b0c1951
2 changed files with 19 additions and 7 deletions

View File

@ -33,6 +33,10 @@ var argv = require("optimist")
.describe("colors", "Output Stats with colors")
.default("colors", false)
.boolean("single")
.describe("single", "Disable lazy loading")
.default("single", false)
.boolean("json")
.describe("json", "Output Stats as JSON")
.default("json", false)
@ -95,6 +99,10 @@ if(argv.debug) {
options.debug = true;
}
if(argv.single) {
options.single = true;
}
if(argv.watch) {
options.watch = true;
}

View File

@ -477,15 +477,19 @@ function addModuleToChunk(depTree, context, chunkId, options) {
}
if(context.asyncs) {
context.asyncs.forEach(function(context) {
var subChunk
if(context.chunkId) {
subChunk = depTree.chunks[context.chunkId];
subChunk.usages++;
if(options.single) {
addModuleToChunk(depTree, context, chunkId, options);
} else {
subChunk = addChunk(depTree, context, options);
var subChunk;
if(context.chunkId) {
subChunk = depTree.chunks[context.chunkId];
subChunk.usages++;
} else {
subChunk = addChunk(depTree, context, options);
}
subChunk.parents = subChunk.parents || [];
subChunk.parents.push(chunkId);
}
subChunk.parents = subChunk.parents || [];
subChunk.parents.push(chunkId);
});
}
}