fix crash because for invalid type

This commit is contained in:
Tobias Koppers 2020-10-26 16:05:25 +01:00
parent b1a742225d
commit f2ed7ca3e3
3 changed files with 7 additions and 4 deletions

View File

@ -580,13 +580,15 @@ class RuntimeTemplate {
}) { }) {
if (runtimeCondition === undefined) return "true"; if (runtimeCondition === undefined) return "true";
if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`; if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`;
/** @type {Set<string>} */
const positiveRuntimeIds = new Set(); const positiveRuntimeIds = new Set();
forEachRuntime(runtimeCondition, runtime => forEachRuntime(runtimeCondition, runtime =>
positiveRuntimeIds.add(chunkGraph.getRuntimeId(runtime)) positiveRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`)
); );
/** @type {Set<string>} */
const negativeRuntimeIds = new Set(); const negativeRuntimeIds = new Set();
forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime => forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime =>
negativeRuntimeIds.add(chunkGraph.getRuntimeId(runtime)) negativeRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`)
); );
runtimeRequirements.add(RuntimeGlobals.runtimeId); runtimeRequirements.add(RuntimeGlobals.runtimeId);
return compileBooleanMatcher.fromLists( return compileBooleanMatcher.fromLists(

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
findBundle: function (i, options) { findBundle: function (i, options) {
return ["shared.js", "a.js", "b.js", "c.js"]; return ["shared.js", "a.js", "b.js", "c1.js", "c2.js"];
} }
}; };

View File

@ -3,7 +3,8 @@ module.exports = {
entry: { entry: {
a: "./a", a: "./a",
b: "./b", b: "./b",
c: "./c" c1: "./c",
c2: "./c"
}, },
target: "web", target: "web",
output: { output: {