flag modules in dlls without entryOnly with side-effects to keep them

This commit is contained in:
Tobias Koppers 2020-12-15 16:38:20 +01:00
parent 1e2634fdd8
commit 06fcc0ad12
3 changed files with 15 additions and 12 deletions

View File

@ -40,6 +40,10 @@ class FlagAllModulesAsUsedPlugin {
const exportsInfo = moduleGraph.getExportsInfo(module);
exportsInfo.setUsedInUnknownWay(runtime);
moduleGraph.addExtraReason(module, this.explanation);
if (module.factoryMeta === undefined) {
module.factoryMeta = {};
}
module.factoryMeta.sideEffectFree = false;
}
}
);

View File

@ -1,2 +1 @@
export default "d";
console.log.bind(console);

View File

@ -51,7 +51,7 @@ it("should give modules the correct ids", function() {
"../0-create-dll/f.jsx",
"../0-create-dll/g.abc.js",
"../0-create-dll/h.js",
"../0-create-dll/hb.js",
"../0-create-dll/h1.js",
"./index.js",
"dll-reference ../0-create-dll/dll.js"
]);