From 258b0c1951f30cffa9245e2760a6ae19d3027b8b Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 29 Jun 2012 20:54:24 +0200 Subject: [PATCH] fixed single option --- bin/webpack.js | 8 ++++++++ lib/buildDeps.js | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bin/webpack.js b/bin/webpack.js index 4fbce45a2..325ea8b93 100644 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -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; } diff --git a/lib/buildDeps.js b/lib/buildDeps.js index e2f93e410..e188ee79c 100644 --- a/lib/buildDeps.js +++ b/lib/buildDeps.js @@ -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); }); } }