Skip to content

docs(configuration): sort performance options #5295

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 3 commits into from
Aug 15, 2021
Merged
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
66 changes: 33 additions & 33 deletions src/content/configuration/performance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,34 @@ This feature was inspired by the idea of [webpack Performance Budgets](https://g

Configure how performance hints are shown. For example if you have an asset that is over 250kb, webpack will emit a warning notifying you of this.

## `performance.hints`
### performance.assetFilter

`function(assetFilename) => boolean`

This property allows webpack to control what files are used to calculate performance hints. The default function is:

```js
function assetFilter(assetFilename) {
return !/\.map$/.test(assetFilename);
}
```

You can override this property by passing your own function in:

```js
module.exports = {
//...
performance: {
assetFilter: function (assetFilename) {
return assetFilename.endsWith('.js');
},
},
};
```

The example above will only give you performance hints based on `.js` files.

### performance.hints

`string = 'warning': 'error' | 'warning'` `boolean: false`

Expand Down Expand Up @@ -59,22 +86,7 @@ module.exports = {

An error will be displayed notifying you of a large asset. We recommend using `hints: "error"` during production builds to help prevent deploying production bundles that are too large, impacting webpage performance.

## `performance.maxEntrypointSize`

`number = 250000`

An entry point represents all assets that would be utilized during initial load time for a specific entry. This option controls when webpack should emit performance hints based on the maximum entry point size in bytes.

```js
module.exports = {
//...
performance: {
maxEntrypointSize: 400000,
},
};
```

## `performance.maxAssetSize`
### performance.maxAssetSize

`number = 250000`

Expand All @@ -89,29 +101,17 @@ module.exports = {
};
```

## `performance.assetFilter`

`function(assetFilename) => boolean`

This property allows webpack to control what files are used to calculate performance hints. The default function is:
### performance.maxEntrypointSize

```js
function assetFilter(assetFilename) {
return !/\.map$/.test(assetFilename);
}
```
`number = 250000`

You can override this property by passing your own function in:
An entry point represents all assets that would be utilized during initial load time for a specific entry. This option controls when webpack should emit performance hints based on the maximum entry point size in bytes.

```js
module.exports = {
//...
performance: {
assetFilter: function (assetFilename) {
return assetFilename.endsWith('.js');
},
maxEntrypointSize: 400000,
},
};
```

The example above will only give you performance hints based on `.js` files.