Skip to content

Commit b733b1a

Browse files
authored
fix: compilation.errors should contain Error objects (#1877)
1 parent dbc9af6 commit b733b1a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,9 @@ class HtmlWebpackPlugin {
13071307

13081308
if ("error" in templateResult) {
13091309
compilation.errors.push(
1310-
prettyError(templateResult.error, compiler.context).toString(),
1310+
new Error(
1311+
prettyError(templateResult.error, compiler.context).toString(),
1312+
),
13111313
);
13121314
}
13131315

@@ -1497,7 +1499,9 @@ class HtmlWebpackPlugin {
14971499
.catch((err) => {
14981500
// In case anything went wrong the promise is resolved
14991501
// with the error message and an error is logged
1500-
compilation.errors.push(prettyError(err, compiler.context).toString());
1502+
compilation.errors.push(
1503+
new Error(prettyError(err, compiler.context).toString()),
1504+
);
15011505
return this.options.showErrors
15021506
? prettyError(err, compiler.context).toHtml()
15031507
: "ERROR";

0 commit comments

Comments
 (0)