diff --git a/src/content/configuration/performance.mdx b/src/content/configuration/performance.mdx index 4fd2a17daf0b..7db08fd31036 100644 --- a/src/content/configuration/performance.mdx +++ b/src/content/configuration/performance.mdx @@ -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` @@ -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` @@ -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.