mirror of https://github.com/webpack/webpack.git
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:
parent
0d4607c68e
commit
fc04bf15bc
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 }) =>
|
||||
|
|
|
@ -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"
|
||||
|
|
1000
test/Errors.test.js
1000
test/Errors.test.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue