Skip to content

Commit cabee27

Browse files
committed
multi module now exports the last module
1 parent f0a2dd0 commit cabee27

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

lib/MultiModule.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ MultiModule.prototype.build = function build(options, compilation, resolver, fs,
3636
};
3737

3838
MultiModule.prototype.source = function(dependencyTemplates, outputOptions, requestShortener) {
39-
var str = ["module.exports = "];
39+
var str = [];
4040
this.dependencies.forEach(function(dep, idx) {
4141
if(dep.module) {
42+
if(idx == this.dependencies.length - 1)
43+
str.push("module.exports = ");
4244
str.push("require(");
4345
if(outputOptions.pathinfo)
4446
str.push("/*! "+dep.request+" */");
@@ -50,7 +52,7 @@ MultiModule.prototype.source = function(dependencyTemplates, outputOptions, requ
5052
str.push("); }())");
5153
}
5254
str.push(";\n");
53-
});
55+
}, this);
5456
return new RawSource(str.join(""));
5557
};
5658

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "webpack",
3-
"version": "0.9.0-beta2",
3+
"version": "0.9.0-beta3",
44
"author": "Tobias Koppers @sokra",
5-
"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.",
5+
"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.",
66
"dependencies": {
77
"esprima": "1.0.x",
88
"mkdirp": "0.3.x",

test/browsertest/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ library1.on("exit", function(code) {
4040
bindOutput(main);
4141
}
4242
});
43-
// node ../../bin/webpack --output-pathinfo --colors --output-library library2 --output-public-path js/ --config library2config.js library2 library2b js/library2.js
43+
// node ../../bin/webpack --output-pathinfo --colors --output-library library2 --output-public-path js/ --config library2config.js library2b library2 js/library2.js
4444
var library2 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--output-library", "library2",
45-
"--output-public-path", "js/", "--config", "library2config.js", "library2", "library2b", "js/library2.js"], extraArgsNoWatch));
45+
"--output-public-path", "js/", "--config", "library2config.js", "library2b", "library2", "js/library2.js"], extraArgsNoWatch));
4646
bindOutput(library2);

0 commit comments

Comments
 (0)