diff --git a/src/content/configuration/stats.md b/src/content/configuration/stats.md index d0b162dd14b3..002bc522814a 100644 --- a/src/content/configuration/stats.md +++ b/src/content/configuration/stats.md @@ -14,6 +14,7 @@ contributors: - grgur - anshumanv - pixel-ray + - snitin315 --- `object` `string` @@ -880,6 +881,39 @@ module.exports = { }; ``` + +W> `stats.warningsFilter` is deprecated in favor of `[stats.ignoreWarnings](#statsignoreWarnings)`. + +### `stats.ignoreWarnings` + +`RegExp` `function (WebpackError, Compilation) => boolean` `{module?: RegExp, file?: RegExp, message?: RegExp}` + +Tells `stats` to ignore specific warnings. This can be done with a `RegExp`, a custom `function` to select warnings based on the raw warning instance which is getting `WebpackError` and `Compilation` as arguments and returns a `boolean`, an `object` with the following properties: + +- `file` : A RegExp to select the origin file for the warning. +- `message` : A RegExp to select the warning message. +- `module` : A RegExp to select the origin module for the warning. + +`stats.ignoreWarnings` can be an `array` of any of the above. + +```javascript +module.exports = { + //... + stats: { + ignoreWarnings: [ + { + module: /module2\.js\?[34]/ // A RegExp + }, + { + module: /[13]/, + message: /homepage/ + }, + (warning) => true + ] + } +}; +``` + ### `stats.chunkRelations` `boolean = false`