diff --git a/lib/errors.js b/lib/errors.js index c6cae4c8..7ed0636e 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -18,7 +18,14 @@ module.exports = function (err, context) { return JSON.stringify(this.toHtml()); }, toString: function () { - return prettyError.render(err).replace(/webpack:\/\/\/\./g, context); + try { + return prettyError.render(err).replace(/webpack:\/\/\/\./g, context); + } catch (e) { + // This can sometimes fail. We don't know why, but returning the + // original error is better than returning the error thrown by + // pretty-error. + return err; + } } }; };