From 2fe98baf3760079c2ad5950efe1d2e523137c863 Mon Sep 17 00:00:00 2001 From: Henry Dineen Date: Tue, 12 Aug 2025 17:20:19 -0400 Subject: [PATCH] fix: compilation.errors should contain Error objects --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7ce48402..efe592d6 100644 --- a/index.js +++ b/index.js @@ -1307,7 +1307,9 @@ class HtmlWebpackPlugin { if ("error" in templateResult) { compilation.errors.push( - prettyError(templateResult.error, compiler.context).toString(), + new Error( + prettyError(templateResult.error, compiler.context).toString(), + ), ); } @@ -1497,7 +1499,9 @@ class HtmlWebpackPlugin { .catch((err) => { // In case anything went wrong the promise is resolved // with the error message and an error is logged - compilation.errors.push(prettyError(err, compiler.context).toString()); + compilation.errors.push( + new Error(prettyError(err, compiler.context).toString()), + ); return this.options.showErrors ? prettyError(err, compiler.context).toHtml() : "ERROR";