Skip to content

Commit 0b8023a

Browse files
committed
fixes webpack#5096
1 parent 39051df commit 0b8023a

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

lib/optimize/ModuleConcatenationPlugin.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ class ModuleConcatenationPlugin {
6161
continue;
6262
}
6363

64+
// Using dependency variables is not possible as this wraps the code in a function
65+
if(module.variables.length > 0) {
66+
setBailoutReason(module, `Module uses injected variables (${module.variables.map(v => v.name).join(", ")})`);
67+
continue;
68+
}
69+
6470
relevantModules.push(module);
6571

6672
// Module must not be the entry points
@@ -69,12 +75,6 @@ class ModuleConcatenationPlugin {
6975
continue;
7076
}
7177

72-
// Using dependency variables is not possible as this wraps the code in a function
73-
if(module.variables.length > 0) {
74-
setBailoutReason(module, "Module uses injected variables (usually caused by the ProvidePlugin)");
75-
continue;
76-
}
77-
7878
// Module must only be used by Harmony Imports
7979
const nonHarmonyReasons = module.reasons.filter(reason => !(reason.dependency instanceof HarmonyImportDependency));
8080
if(nonHarmonyReasons.length > 0) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { a } from './index';
2+
3+
export const b = a();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { b } from './b';
2+
3+
export function a() {
4+
return "a";
5+
};
6+
7+
// Inject a variable
8+
if(Math.random() < -1)
9+
console.log(module);
10+
11+
it("should compile fine", function() {
12+
b.should.be.eql("a");
13+
});

0 commit comments

Comments
 (0)