Skip to content

Commit cb4c209

Browse files
authored
Merge pull request webpack#3601 from webpack/bugfix/delete-assets
fixes webpack#3596
2 parents 56924c6 + 84913ec commit cb4c209

4 files changed

Lines changed: 26 additions & 1 deletion

File tree

lib/performance/SizeLimitsPlugin.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ SizeLimitsPlugin.prototype.apply = function(compiler) {
3434
return files
3535
.filter(assetFilter)
3636
.map(function(file) {
37-
return compilation.assets[file].size()
37+
return compilation.assets[file];
38+
})
39+
.filter(Boolean)
40+
.map(function(asset) {
41+
return asset.size()
3842
})
3943
.reduce(function(currentSize, nextSize) {
4044
return currentSize + nextSize
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it("should not be executed", function() {
2+
throw new Error("should not be executed");
3+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
it("should compile correctly", function() {});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
entry: {
3+
bundle0: "./index",
4+
b: "./b"
5+
},
6+
output: {
7+
filename: "[name].js"
8+
},
9+
plugins: [
10+
function() {
11+
this.plugin("emit", function(compilation, callback) {
12+
delete compilation.assets["b.js"];
13+
callback();
14+
})
15+
}
16+
]
17+
}

0 commit comments

Comments
 (0)