Merge pull request #1764 from jnwng/jw/dll-plugin

Using DllPlugin with multiple chunks ends without emitting chunks.
This commit is contained in:
Tobias Koppers 2015-12-18 18:32:03 +01:00
commit d883923da1
4 changed files with 39 additions and 1 deletions

View File

@ -12,8 +12,10 @@ module.exports = LibManifestPlugin;
LibManifestPlugin.prototype.apply = function(compiler) {
compiler.plugin("emit", function(compilation, callback) {
async.forEach(compilation.chunks, function(chunk, callback) {
if(!chunk.initial)
if(!chunk.initial) {
callback();
return;
}
var targetPath = compilation.getPath(this.options.path, {
hash: compilation.hash,
chunk: chunk

View File

@ -0,0 +1 @@
module.exports = "a";

View File

@ -0,0 +1,17 @@
var fs = require("fs");
var path = require("path");
it("should complete", function(done) {
require.ensure(["./a"], function(require) {
require("./a").should.be.eql("a");
done();
});
});
it("should write the correct manifest", function() {
var manifest = JSON.parse(fs.readFileSync(path.join(__dirname, 'bundle0-manifest.json'), "utf-8"));
manifest.should.have.key("content", "name");
manifest.content.should.not.have.property("./a.js");
manifest.content.should.have.property("./index.js");
manifest.content["./index.js"].should.eql(0);
});

View File

@ -0,0 +1,18 @@
var path = require("path");
var webpack = require("../../../../");
var LibManifestPlugin = require("../../../../lib/LibManifestPlugin");
module.exports = {
entry: {
bundle0: ["./"]
},
plugins: [
new LibManifestPlugin({
path: path.resolve(__dirname, '../../../js/config/plugins/lib-manifest-plugin/[name]-manifest.json'),
name: "[name]_[hash]"
})
],
node: {
__dirname: false
}
}