Skip to content

Commit d6a7594

Browse files
committed
harmony modules without exports have no exports instead of unknown
1 parent 7eb7529 commit d6a7594

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/FlagDependencyExportsPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FlagDependencyExportsPlugin {
1919
module = queue[i];
2020

2121
if(module.providedExports !== true) {
22-
moduleWithExports = false;
22+
moduleWithExports = module.meta && module.meta.harmonyModule;
2323
moduleProvidedExports = Array.isArray(module.providedExports) ? new Set(module.providedExports) : new Set();
2424
processDependenciesBlock(module);
2525
if(!moduleWithExports) {

lib/Stats.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,10 @@ class Stats {
641641
const processModuleContent = (module, prefix) => {
642642
if(Array.isArray(module.providedExports)) {
643643
colors.normal(prefix);
644-
colors.cyan(`[exports: ${module.providedExports.join(", ")}]`);
644+
if(module.providedExports.length === 0)
645+
colors.cyan("[no exports]");
646+
else
647+
colors.cyan(`[exports: ${module.providedExports.join(", ")}]`);
645648
newline();
646649
}
647650
if(module.usedExports !== undefined) {

test/statsCases/tree-shaking/expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ bundle.js 7.33 kB 0 [emitted] main
1111
[2] (webpack)/test/statsCases/tree-shaking/unknown.js 0 bytes {0} [built]
1212
[only some exports used: c]
1313
[3] (webpack)/test/statsCases/tree-shaking/index.js 276 bytes {0} [built]
14+
[no exports]
1415
[4] (webpack)/test/statsCases/tree-shaking/reexport-known.js 49 bytes {0} [built]
1516
[exports: a, b]
1617
[only some exports used: a]

0 commit comments

Comments
 (0)