Skip to content

docs: stats.ignoreWarnings should be ignoreWarnings #4076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/content/configuration/other-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ contributors:
- niravasher
- Neob91
- chenxsan
- u01jmg3
related:
- title: Using Records
url: https://survivejs.com/webpack/optimizing/separating-manifest/#using-records
Expand Down Expand Up @@ -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`
Expand Down
33 changes: 2 additions & 31 deletions src/content/configuration/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ contributors:
- anshumanv
- pixel-ray
- snitin315
- u01jmg3
---

`object` `string`
Expand Down Expand Up @@ -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`](/configuration/other-options/#ignorewarnings).

### `stats.chunkRelations`

Expand Down