errors.js 669 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. const PrettyError = require('pretty-error');
  3. const prettyError = new PrettyError();
  4. prettyError.withoutColors();
  5. prettyError.skipPackage(['html-plugin-evaluation']);
  6. prettyError.skipNodeFiles();
  7. prettyError.skip(function (traceLine) {
  8. return traceLine.path === 'html-plugin-evaluation';
  9. });
  10. module.exports = function (err, context) {
  11. return {
  12. toHtml: function () {
  13. return 'Html Webpack Plugin:\n<pre>\n' + this.toString() + '</pre>';
  14. },
  15. toJsonHtml: function () {
  16. return JSON.stringify(this.toHtml());
  17. },
  18. toString: function () {
  19. return prettyError.render(err).replace(/webpack:\/\/\/\./g, context);
  20. }
  21. };
  22. };