Skip to content

Commit 37066fc

Browse files
committed
fix another bug observed in webpack#2977
1 parent f47e920 commit 37066fc

5 files changed

Lines changed: 27 additions & 15 deletions

File tree

lib/FlagDependencyExportsPlugin.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ FlagDependencyExportsPlugin.prototype.apply = function(compiler) {
2525
processDependenciesBlock(module);
2626
if(!moduleWithExports) {
2727
module.providedExports = true;
28+
notifyDependencies();
2829
}
2930
}
3031
}
@@ -73,12 +74,16 @@ FlagDependencyExportsPlugin.prototype.apply = function(compiler) {
7374
};
7475
}
7576
if(changed) {
76-
var deps = dependencies["$" + module.identifier()];
77-
if(deps) {
78-
deps.forEach(function(dep) {
79-
queue.push(dep);
80-
});
81-
}
77+
notifyDependencies();
78+
}
79+
}
80+
81+
function notifyDependencies() {
82+
var deps = dependencies["$" + module.identifier()];
83+
if(deps) {
84+
deps.forEach(function(dep) {
85+
queue.push(dep);
86+
});
8287
}
8388
}
8489
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export var x = 1;
2+
export * from "./unknown2";
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Hash: 11b123cb23c353a91fe4
1+
Hash: 8bac53cc0c37d71baf6b
22
Time: Xms
33
Asset Size Chunks Chunk Names
4-
bundle.js 6.46 kB 0 [emitted] main
5-
chunk {0} bundle.js (main) 512 bytes [entry] [rendered]
4+
bundle.js 7.22 kB 0 [emitted] main
5+
chunk {0} bundle.js (main) 588 bytes [entry] [rendered]
66
[0] (webpack)/test/statsCases/tree-shaking/a.js 13 bytes {0} [built]
77
[exports: a]
88
[only some exports used: a]
@@ -11,15 +11,19 @@ chunk {0} bundle.js (main) 512 bytes [entry] [rendered]
1111
[only some exports used: ]
1212
[2] (webpack)/test/statsCases/tree-shaking/unknown.js 0 bytes {0} [built]
1313
[only some exports used: a, c]
14-
[3] (webpack)/test/statsCases/tree-shaking/reexport-known.js 49 bytes {0} [built]
14+
[3] (webpack)/test/statsCases/tree-shaking/edge.js 45 bytes {0} [built]
15+
[only some exports used: y]
16+
[4] (webpack)/test/statsCases/tree-shaking/reexport-known.js 49 bytes {0} [built]
1517
[exports: a, b]
1618
[only some exports used: a]
17-
[4] (webpack)/test/statsCases/tree-shaking/reexport-star-known.js 41 bytes {0} [built]
19+
[5] (webpack)/test/statsCases/tree-shaking/reexport-star-known.js 41 bytes {0} [built]
1820
[exports: a, b]
1921
[only some exports used: a]
20-
[5] (webpack)/test/statsCases/tree-shaking/reexport-star-unknown.js 68 bytes {0} [built]
22+
[6] (webpack)/test/statsCases/tree-shaking/reexport-star-unknown.js 68 bytes {0} [built]
2123
[only some exports used: a, c]
22-
[6] (webpack)/test/statsCases/tree-shaking/reexport-unknown.js 83 bytes {0} [built]
24+
[7] (webpack)/test/statsCases/tree-shaking/reexport-unknown.js 83 bytes {0} [built]
2325
[exports: a, b, c, d]
2426
[only some exports used: a, c]
25-
[7] (webpack)/test/statsCases/tree-shaking/index.js 245 bytes {0} [built]
27+
[8] (webpack)/test/statsCases/tree-shaking/unknown2.js 0 bytes {0} [built]
28+
[only some exports used: y]
29+
[9] (webpack)/test/statsCases/tree-shaking/index.js 276 bytes {0} [built]

test/statsCases/tree-shaking/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import { a as a1 } from "./reexport-known";
22
import { a as a2, c as c2 } from "./reexport-unknown";
33
import { a as a3} from "./reexport-star-known";
44
import { a as a4, c as c4 } from "./reexport-star-unknown";
5+
import { y } from "./edge";
56

6-
console.log(a1, a2, a3, a4, c2, c4);
7+
console.log(a1, a2, a3, a4, c2, c4, y);

test/statsCases/tree-shaking/unknown2.js

Whitespace-only changes.

0 commit comments

Comments
 (0)