From 5ff9a1486f321122595d94cf9159aebff994c721 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 22 Feb 2021 09:03:03 +0100 Subject: [PATCH 1/2] add test case --- test/Defaults.unittest.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index 166dedd11b0..ba1c3f6b033 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -1703,4 +1703,24 @@ describe("Defaults", () => { process.chdir(cwd); } ); + + test( + "array defaults", + { + output: { + enabledChunkLoadingTypes: ["require", "..."], + enabledWasmLoadingTypes: ["...", "async-node"] + } + }, + e => + e.toMatchInlineSnapshot(` + - Expected + + Received + + @@ ... @@ + + "require", + @@ ... @@ + + "async-node", + `) + ); }); From e63e73371324bee6bc45d40c0dd37726f064ab7b Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 22 Feb 2021 09:03:12 +0100 Subject: [PATCH 2/2] fix array expansion when using "..." --- lib/config/defaults.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config/defaults.js b/lib/config/defaults.js index d45303d81e5..451626f6884 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -95,7 +95,7 @@ const A = (obj, prop, factory) => { const item = value[i]; if (item === "...") { if (newArray === undefined) { - newArray = i > 0 ? value.slice(0, i - 1) : []; + newArray = value.slice(0, i); obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray)); } const items = /** @type {any[]} */ (/** @type {unknown} */ (factory()));