[webpack-bundle-analyzer] Add excludeAssets option (#28756)

This was added in webpack-bundle-analyzer 2.12.0
This commit is contained in:
Michael Strobel
2018-09-10 14:33:07 -07:00
committed by Ryan Cavanaugh
parent 0125d65fd5
commit c86f6b0ccf
2 changed files with 19 additions and 1 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for webpack-bundle-analyzer 2.9
// Type definitions for webpack-bundle-analyzer 2.13
// Project: https://github.com/th0r/webpack-bundle-analyzer
// Definitions by: Michael Strobel <https://github.com/kryops>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,6 +7,9 @@
import * as webpack from 'webpack';
export namespace BundleAnalyzerPlugin {
type ExcludeAssetsPatternFn = (assetName: string) => boolean;
type ExcludeAssetsPattern = string | RegExp | ExcludeAssetsPatternFn;
interface Options {
/**
* Can be "server", "static" or "disabled".
@@ -68,6 +71,16 @@ export namespace BundleAnalyzerPlugin {
*/
statsOptions?: null | webpack.Stats.ToJsonOptionsObject;
/**
* Default: `null`.
* Patterns that will be used to match against asset names to exclude them from the report.
* If pattern is a string it will be converted to RegExp via `new RegExp(str)`.
* If pattern is a function it should have the following signature `(assetName: string) => boolean`
* and should return true to exclude matching asset.
* If multiple patterns are provided asset should match at least one of them to be excluded.
*/
excludeAssets?: null | ExcludeAssetsPattern | ExcludeAssetsPattern[];
/**
* Log level. Can be "info", "warn", "error" or "silent".
* Defaults to "info"
@@ -19,6 +19,11 @@ const config: webpack.Configuration = {
statsOptions: {
source: false
},
excludeAssets: [
'foo',
/foo/,
assetName => assetName.indexOf('foo') !== -1
],
logLevel: 'info'
})
]