Skip to content

Commit

Permalink
cleanup messages and added more info
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jul 24, 2017
1 parent 15ccfb6 commit 05b913a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions lib/optimize/ModuleConcatenationPlugin.js
Expand Up @@ -78,9 +78,10 @@ class ModuleConcatenationPlugin {
const nonHarmonyReasons = module.reasons.filter(reason => !(reason.dependency instanceof HarmonyImportDependency));
if(nonHarmonyReasons.length > 0) {
const importingModules = new Set(nonHarmonyReasons.map(r => r.module));
const importingModuleTypes = new Map(Array.from(importingModules).map(m => [m, new Set(nonHarmonyReasons.filter(r => r.module === m).map(r => r.dependency.type).sort())]));
setBailoutReason(module, (requestShortener) => {
const names = Array.from(importingModules).map(m => m.readableIdentifier(requestShortener)).sort();
return `Module is referenced from these non-ECMAScript modules: ${names.join(", ")}`;
const names = Array.from(importingModules).map(m => `${m.readableIdentifier(requestShortener)} (referenced with ${Array.from(importingModuleTypes.get(m)).join(", ")})`).sort();
return `Module is referenced from these modules with unsupported syntax: ${names.join(", ")}`;
});
continue;
}
Expand Down Expand Up @@ -143,9 +144,9 @@ class ModuleConcatenationPlugin {
const reason = getBailoutReason(warning[0], requestShortener);
const reasonWithPrefix = reason ? ` (<- ${reason})` : "";
if(warning[0] === warning[1])
return formatBailoutReason(`Cannot concat with unsupported ${warning[0].readableIdentifier(requestShortener)}${reasonWithPrefix}`);
return formatBailoutReason(`Cannot concat with ${warning[0].readableIdentifier(requestShortener)}${reasonWithPrefix}`);
else
return formatBailoutReason(`Cannot concat with unsupported ${warning[0].readableIdentifier(requestShortener)} because of ${warning[1].readableIdentifier(requestShortener)}${reasonWithPrefix}`);
return formatBailoutReason(`Cannot concat with ${warning[0].readableIdentifier(requestShortener)} because of ${warning[1].readableIdentifier(requestShortener)}${reasonWithPrefix}`);
});
}
const chunks = concatConfiguration.rootModule.getChunks();
Expand Down
10 changes: 5 additions & 5 deletions test/statsCases/scope-hoisting-multi/expected.txt
Expand Up @@ -23,13 +23,13 @@ Child
[3] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy.js 25 bytes {1} {2} [built]
[4] (webpack)/test/statsCases/scope-hoisting-multi/first.js + 1 modules 238 bytes {4} [built]
ModuleConcatenation bailout: Module is an entry point
ModuleConcatenation bailout: Cannot concat with unsupported (webpack)/test/statsCases/scope-hoisting-multi/common.js
ModuleConcatenation bailout: Cannot concat with unsupported (webpack)/test/statsCases/scope-hoisting-multi/vendor.js (<- Module is an entry point)
ModuleConcatenation bailout: Cannot concat with (webpack)/test/statsCases/scope-hoisting-multi/common.js
ModuleConcatenation bailout: Cannot concat with (webpack)/test/statsCases/scope-hoisting-multi/vendor.js (<- Module is an entry point)
[5] (webpack)/test/statsCases/scope-hoisting-multi/lazy_shared.js 31 bytes {0} [built]
ModuleConcatenation bailout: Module is referenced from these non-ECMAScript modules: (webpack)/test/statsCases/scope-hoisting-multi/first.js, (webpack)/test/statsCases/scope-hoisting-multi/second.js
ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: (webpack)/test/statsCases/scope-hoisting-multi/first.js (referenced with import()), (webpack)/test/statsCases/scope-hoisting-multi/second.js (referenced with import())
[6] (webpack)/test/statsCases/scope-hoisting-multi/second.js 177 bytes {3} [built]
ModuleConcatenation bailout: Module is an entry point
[7] (webpack)/test/statsCases/scope-hoisting-multi/lazy_second.js 55 bytes {1} [built]
ModuleConcatenation bailout: Module is referenced from these non-ECMAScript modules: (webpack)/test/statsCases/scope-hoisting-multi/second.js
ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: (webpack)/test/statsCases/scope-hoisting-multi/second.js (referenced with import())
[8] (webpack)/test/statsCases/scope-hoisting-multi/lazy_first.js 55 bytes {2} [built]
ModuleConcatenation bailout: Module is referenced from these non-ECMAScript modules: (webpack)/test/statsCases/scope-hoisting-multi/first.js
ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: (webpack)/test/statsCases/scope-hoisting-multi/first.js (referenced with import())

0 comments on commit 05b913a

Please sign in to comment.