Skip to content

Commit 3c23ec3

Browse files
committed
Merge pull request webpack#2114 from SimenB/backport-1764
Backport webpack#1764
2 parents af0acf1 + 3856486 commit 3c23ec3

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

lib/LibManifestPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ module.exports = LibManifestPlugin;
1212
LibManifestPlugin.prototype.apply = function(compiler) {
1313
compiler.plugin("emit", function(compilation, callback) {
1414
async.forEach(compilation.chunks, function(chunk, callback) {
15-
if(!chunk.initial)
15+
if(!chunk.initial) {
16+
callback();
1617
return;
18+
}
1719
var targetPath = compilation.getPath(this.options.path, {
1820
hash: compilation.hash,
1921
chunk: chunk
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "a";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var fs = require("fs");
2+
var path = require("path");
3+
4+
it("should complete", function(done) {
5+
require.ensure(["./a"], function(require) {
6+
require("./a").should.be.eql("a");
7+
done();
8+
});
9+
});
10+
11+
it("should write the correct manifest", function() {
12+
var manifest = JSON.parse(fs.readFileSync(path.join(__dirname, 'bundle0-manifest.json'), "utf-8"));
13+
manifest.should.have.key("content", "name");
14+
manifest.content.should.not.have.property("./a.js");
15+
manifest.content.should.have.property("./index.js");
16+
manifest.content["./index.js"].should.eql(1);
17+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var path = require("path");
2+
var webpack = require("../../../../");
3+
var LibManifestPlugin = require("../../../../lib/LibManifestPlugin");
4+
5+
module.exports = {
6+
entry: {
7+
bundle0: ["./"]
8+
},
9+
plugins: [
10+
new LibManifestPlugin({
11+
path: path.resolve(__dirname, '../../../js/config/plugins/lib-manifest-plugin/[name]-manifest.json'),
12+
name: "[name]_[hash]"
13+
})
14+
],
15+
node: {
16+
__dirname: false
17+
}
18+
}

0 commit comments

Comments
 (0)