Skip to content

Commit 026170a

Browse files
committed
don't deduplicate modules with async blocks
fixes webpack-contrib/bundle-loader#15
1 parent 13c3a3c commit 026170a

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

lib/optimize/DedupePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ DedupePlugin.prototype.apply = function(compiler) {
1818
var modulesByHash = {};
1919
var allDups = [];
2020
modules.forEach(function(module, idx) {
21-
if(!module.getSourceHash || !module.getAllModuleDependencies || !module.createTemplate || !module.getTemplateArguments) return;
21+
if(!module.getSourceHash || !module.getAllModuleDependencies || !module.createTemplate || !module.getTemplateArguments || module.blocks.length > 0) return;
2222
var hash = module.getSourceHash();
2323
var dupModule = modulesByHash[hash];
2424
if(dupModule) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "a";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "b";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
it("should load a duplicate module with different dependencies correctly", function(done) {
2+
var a = require("bundle!./a/file");
3+
var b = require("bundle!./b/file");
4+
(typeof a).should.be.eql("function");
5+
(typeof b).should.be.eql("function");
6+
a(function(ra) {
7+
ra.should.be.eql("a");
8+
b(function(rb) {
9+
rb.should.be.eql("b");
10+
done();
11+
})
12+
});
13+
});

0 commit comments

Comments
 (0)