Skip to content

Commit

Permalink
Make sure it's a real module when choosing for ModuleConcatenation
Browse files Browse the repository at this point in the history
fixes #5095
  • Loading branch information
sokra committed Jul 25, 2017
1 parent d4f3bc3 commit 35c8097
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/optimize/ModuleConcatenationPlugin.js
Expand Up @@ -7,6 +7,7 @@
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
const ConcatenatedModule = require("./ConcatenatedModule");
const HarmonyExportImportedSpecifierDependency = require("../dependencies/HarmonyExportImportedSpecifierDependency");
const HarmonyCompatibilityDependency = require("../dependencies/HarmonyCompatibilityDependency");

class ModuleConcatenationPlugin {
constructor(options) {
Expand Down Expand Up @@ -39,7 +40,7 @@ class ModuleConcatenationPlugin {
const possibleInners = new Set();
for(const module of modules) {
// Only harmony modules are valid for optimization
if(!module.meta || !module.meta.harmonyModule) {
if(!module.meta || !module.meta.harmonyModule || !module.dependencies.some(d => d instanceof HarmonyCompatibilityDependency)) {
continue;
}

Expand Down
5 changes: 5 additions & 0 deletions test/configCases/scope-hoisting/dll-plugin/index.js
@@ -0,0 +1,5 @@
import value from "dll/module";

it("should not scope hoist delegated modules", function() {
value.should.be.eql("ok");
});
19 changes: 19 additions & 0 deletions test/configCases/scope-hoisting/dll-plugin/webpack.config.js
@@ -0,0 +1,19 @@
var webpack = require("../../../../");
module.exports = {
plugins: [
new webpack.DllReferencePlugin({
name: "function(id) { return {default: 'ok'}; }",
scope: "dll",
content: {
"./module": {
id: 1,
meta: {
harmonyModule: true
},
exports: ["default"]
}
}
}),
new webpack.optimize.ModuleConcatenationPlugin()
]
};

0 comments on commit 35c8097

Please sign in to comment.