|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | // @ts-nocheck
|
|---|
| 2 | "use strict";
|
|---|
| 3 |
|
|---|
| 4 | let prettyError;
|
|---|
| 5 |
|
|---|
| 6 | function getPrettyError() {
|
|---|
| 7 | if (!prettyError) {
|
|---|
| 8 | // lazily require to improve startup time since pretty-error is rather heavy package
|
|---|
| 9 | const PrettyError = require("pretty-error");
|
|---|
| 10 | prettyError = new PrettyError();
|
|---|
| 11 | prettyError.withoutColors();
|
|---|
| 12 | prettyError.skipPackage("html-plugin-evaluation");
|
|---|
| 13 | prettyError.skipNodeFiles();
|
|---|
| 14 | prettyError.skip(function (traceLine) {
|
|---|
| 15 | return traceLine.path === "html-plugin-evaluation";
|
|---|
| 16 | });
|
|---|
| 17 | }
|
|---|
| 18 | return prettyError;
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | module.exports = function (err, context) {
|
|---|
| 22 | return {
|
|---|
| 23 | toHtml: function () {
|
|---|
| 24 | return "Html Webpack Plugin:\n<pre>\n" + this.toString() + "</pre>";
|
|---|
| 25 | },
|
|---|
| 26 | toJsonHtml: function () {
|
|---|
| 27 | return JSON.stringify(this.toHtml());
|
|---|
| 28 | },
|
|---|
| 29 | toString: function () {
|
|---|
| 30 | try {
|
|---|
| 31 | return getPrettyError()
|
|---|
| 32 | .render(err)
|
|---|
| 33 | .replace(/webpack:\/\/\/\./g, context);
|
|---|
| 34 | } catch (e) {
|
|---|
| 35 | // This can sometimes fail. We don't know why, but returning the
|
|---|
| 36 | // original error is better than returning the error thrown by
|
|---|
| 37 | // pretty-error.
|
|---|
| 38 | return err;
|
|---|
| 39 | }
|
|---|
| 40 | },
|
|---|
| 41 | };
|
|---|
| 42 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.