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));