From e36e671f392e3af28b8bd80707f0ee3fdf6f2160 Mon Sep 17 00:00:00 2001 From: robert-irelan-tiktokusds <165758393+robert-irelan-tiktokusds@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:15:29 -0700 Subject: [PATCH] Handle childCompilation.errors being an iterator rather than array Fix https://github.com/jantimon/html-webpack-plugin/issues/1846 --- lib/child-compiler.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/child-compiler.js b/lib/child-compiler.js index e4ba4f91..ff2c6e4f 100644 --- a/lib/child-compiler.js +++ b/lib/child-compiler.js @@ -198,15 +198,15 @@ class HtmlWebpackChildCompiler { childCompilation.errors && childCompilation.errors.length ) { - const errorDetails = childCompilation.errors - .map((error) => { - let message = error.message; - if (error.stack) { - message += "\n" + error.stack; - } - return message; - }) - .join("\n"); + const errorDetailsArray = []; + for (const error of childCompilation.errors) { + let message = error.message; + if (error.stack) { + message += "\n" + error.stack; + } + errorDetailsArray.push(message); + } + const errorDetails = errorDetailsArray.join("\n"); reject(new Error("Child compilation failed:\n" + errorDetails));