From 25190a57f940a803f939764bd56a41d68960df59 Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Thu, 17 Oct 2024 19:29:07 +0300 Subject: [PATCH] fix: handle `childCompilation.errors` being an iterator rather than array --- 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));