Do not show stack trace of errors in stats by default

Add new `stats.errorStack` option to display it anyway.
This commit is contained in:
Tobias Koppers 2019-10-14 22:34:40 +02:00
parent 0d4607c68e
commit fc04bf15bc
5 changed files with 533 additions and 488 deletions

View File

@ -1499,6 +1499,10 @@ export interface StatsOptions {
* add details to errors (like resolving log)
*/
errorDetails?: boolean;
/**
* add internal stack trace to errors
*/
errorStack?: boolean;
/**
* add errors
*/

View File

@ -119,12 +119,7 @@ const uniqueOrderedArray = (items, selector, comparator) => {
/** @type {ExtractorsByOption<WebpackError | string>} */
const EXTRACT_ERROR = {
_: (
object,
error,
{ compilation: { chunkGraph, moduleGraph } },
{ requestShortener }
) => {
_: (object, error, context, { requestShortener }) => {
// TODO webpack 6 disallow strings in the errors/warnings list
if (typeof error === "string") {
object.message = error;
@ -184,6 +179,10 @@ const EXTRACT_ERROR = {
errorDetails: (object, error) => {
if (typeof error !== "string") {
object.details = error.details;
}
},
errorStack: (object, error) => {
if (typeof error !== "string") {
object.stack = error.stack;
}
}

View File

@ -36,6 +36,7 @@ const NAMED_PRESETS = {
providedExports: true,
optimizationBailout: true,
errorDetails: true,
errorStack: true,
publicPath: true,
logging: "verbose",
orphanModules: true,
@ -147,6 +148,7 @@ const DEFAULTS = {
moduleTrace: NORMAL_ON,
errors: NORMAL_ON,
errorDetails: OFF_FOR_TO_STRING,
errorStack: OFF_FOR_TO_STRING,
warnings: NORMAL_ON,
publicPath: OFF_FOR_TO_STRING,
logging: ({ all }, { forToString }) =>

View File

@ -2087,6 +2087,10 @@
"description": "add details to errors (like resolving log)",
"type": "boolean"
},
"errorStack": {
"description": "add internal stack trace to errors",
"type": "boolean"
},
"errors": {
"description": "add errors",
"type": "boolean"

File diff suppressed because it is too large Load Diff