From 2271a3bff8955cfd7005bedca65ca88eab17e81b Mon Sep 17 00:00:00 2001 From: Jonathan Goode Date: Sat, 17 Oct 2020 14:40:27 +0100 Subject: [PATCH 1/2] docs: `stats.ignoreWarnings` should be `ignoreWarnings` --- src/content/configuration/other-options.md | 29 +++++++++++++++++++ src/content/configuration/stats.md | 33 ++-------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/content/configuration/other-options.md b/src/content/configuration/other-options.md index afdb4e96e3b0..0d10e5790a61 100644 --- a/src/content/configuration/other-options.md +++ b/src/content/configuration/other-options.md @@ -14,6 +14,7 @@ contributors: - niravasher - Neob91 - chenxsan + - u01jmg3 related: - title: Using Records url: https://survivejs.com/webpack/optimizing/separating-manifest/#using-records @@ -302,6 +303,34 @@ module.exports = { W> `cache.idleTimeoutForInitialStore` is only available when [`cache.store`](#cachestore) is set to `'pack'` +## `ignoreWarnings` + +`RegExp` `function (WebpackError, Compilation) => boolean` `{module?: RegExp, file?: RegExp, message?: RegExp}` + +Tells webpack 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. + +`ignoreWarnings` can be an `array` of any of the above. + +```javascript +module.exports = { + //... + ignoreWarnings: [ + { + module: /module2\.js\?[34]/ // A RegExp + }, + { + module: /[13]/, + message: /homepage/ + }, + (warning) => true + ] +}; +``` + ## `loader` `object` diff --git a/src/content/configuration/stats.md b/src/content/configuration/stats.md index b56a2eb40a8a..dd98a1c522a9 100644 --- a/src/content/configuration/stats.md +++ b/src/content/configuration/stats.md @@ -15,6 +15,7 @@ contributors: - anshumanv - pixel-ray - snitin315 + - u01jmg3 --- `object` `string` @@ -1017,37 +1018,7 @@ 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 - ] - } -}; -``` +W> `stats.warningsFilter` is deprecated in favor of [`ignoreWarnings`](https://webpack.js.org/configuration/other-options/#ignorewarnings). ### `stats.chunkRelations` From ee1f695be64423f369b488d82c28a0a3fd1b1002 Mon Sep 17 00:00:00 2001 From: Sam Chen Date: Sat, 31 Oct 2020 15:26:54 +0800 Subject: [PATCH 2/2] update link --- src/content/configuration/stats.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/configuration/stats.md b/src/content/configuration/stats.md index dd98a1c522a9..01e05955a9ad 100644 --- a/src/content/configuration/stats.md +++ b/src/content/configuration/stats.md @@ -1018,7 +1018,7 @@ module.exports = { ``` -W> `stats.warningsFilter` is deprecated in favor of [`ignoreWarnings`](https://webpack.js.org/configuration/other-options/#ignorewarnings). +W> `stats.warningsFilter` is deprecated in favor of [`ignoreWarnings`](/configuration/other-options/#ignorewarnings). ### `stats.chunkRelations`