Skip to content

Commit

Permalink
fix: add fallbacks to moduleName and loc webpack 5 error fields i…
Browse files Browse the repository at this point in the history
…f not present in error formatter (#447)
  • Loading branch information
UncleJart authored Jan 30, 2024
1 parent c39b5f4 commit 06108ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ function formatErrors(errors) {

// Convert webpack@5 error info into a backwards-compatible flat string
return errors.map(function (error) {
return error.moduleName + ' ' + error.loc + '\n' + error.message;
var moduleName = error.moduleName || '';
var loc = error.loc || '';
return moduleName + ' ' + loc + '\n' + error.message;
});
}

Expand Down

0 comments on commit 06108ba

Please sign in to comment.