Skip to content

Commit 35c8097

Browse files
committed
Make sure it's a real module when choosing for ModuleConcatenation
fixes webpack#5095
1 parent d4f3bc3 commit 35c8097

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎lib/optimize/ModuleConcatenationPlugin.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
88
const ConcatenatedModule = require("./ConcatenatedModule");
99
const HarmonyExportImportedSpecifierDependency = require("../dependencies/HarmonyExportImportedSpecifierDependency");
10+
const HarmonyCompatibilityDependency = require("../dependencies/HarmonyCompatibilityDependency");
1011

1112
class ModuleConcatenationPlugin {
1213
constructor(options) {
@@ -39,7 +40,7 @@ class ModuleConcatenationPlugin {
3940
const possibleInners = new Set();
4041
for(const module of modules) {
4142
// Only harmony modules are valid for optimization
42-
if(!module.meta || !module.meta.harmonyModule) {
43+
if(!module.meta || !module.meta.harmonyModule || !module.dependencies.some(d => d instanceof HarmonyCompatibilityDependency)) {
4344
continue;
4445
}
4546

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import value from "dll/module";
2+
3+
it("should not scope hoist delegated modules", function() {
4+
value.should.be.eql("ok");
5+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var webpack = require("../../../../");
2+
module.exports = {
3+
plugins: [
4+
new webpack.DllReferencePlugin({
5+
name: "function(id) { return {default: 'ok'}; }",
6+
scope: "dll",
7+
content: {
8+
"./module": {
9+
id: 1,
10+
meta: {
11+
harmonyModule: true
12+
},
13+
exports: ["default"]
14+
}
15+
}
16+
}),
17+
new webpack.optimize.ModuleConcatenationPlugin()
18+
]
19+
};

0 commit comments

Comments
 (0)