multi module now exports the last module

This commit is contained in:
Tobias Koppers 2013-02-01 10:45:19 +01:00
parent f0a2dd0b65
commit cabee2778c
3 changed files with 8 additions and 6 deletions

View File

@ -36,9 +36,11 @@ MultiModule.prototype.build = function build(options, compilation, resolver, fs,
};
MultiModule.prototype.source = function(dependencyTemplates, outputOptions, requestShortener) {
var str = ["module.exports = "];
var str = [];
this.dependencies.forEach(function(dep, idx) {
if(dep.module) {
if(idx == this.dependencies.length - 1)
str.push("module.exports = ");
str.push("require(");
if(outputOptions.pathinfo)
str.push("/*! "+dep.request+" */");
@ -50,7 +52,7 @@ MultiModule.prototype.source = function(dependencyTemplates, outputOptions, requ
str.push("); }())");
}
str.push(";\n");
});
}, this);
return new RawSource(str.join(""));
};

View File

@ -1,8 +1,8 @@
{
"name": "webpack",
"version": "0.9.0-beta2",
"version": "0.9.0-beta3",
"author": "Tobias Koppers @sokra",
"description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.",
"description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
"dependencies": {
"esprima": "1.0.x",
"mkdirp": "0.3.x",

View File

@ -40,7 +40,7 @@ library1.on("exit", function(code) {
bindOutput(main);
}
});
// node ../../bin/webpack --output-pathinfo --colors --output-library library2 --output-public-path js/ --config library2config.js library2 library2b js/library2.js
// node ../../bin/webpack --output-pathinfo --colors --output-library library2 --output-public-path js/ --config library2config.js library2b library2 js/library2.js
var library2 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--output-library", "library2",
"--output-public-path", "js/", "--config", "library2config.js", "library2", "library2b", "js/library2.js"], extraArgsNoWatch));
"--output-public-path", "js/", "--config", "library2config.js", "library2b", "library2", "js/library2.js"], extraArgsNoWatch));
bindOutput(library2);