Send the stats of a build to a reporting service. Currently DataDog is the only reporter implemented.
npm install --save-dev stats-reporter-webpack-plugin
const { StatsPlugin, DataDogStatsReporter } = require('stats-reporter-webpack-plugin');
module.exports = {
plugins: [
new StatsReporterPlugin({
test:
reporter: new DataDogStatsReporter({
apiKey: process.env.DD_API_KEY,
metricName: 'my-app.assets',
tags: ['app:my-app', 'env:production'],
test: /(js|css)$/
})
})
]
};
new StatsReporterPlugin(options: StatsReporterPluginOptions);
reporter: StatsReporter
: The reporter to use for sending stats.
new DataDogStatsReporter(options: DataDogStatsReporterOptions);
apiKey: string
: Your DataDog API keygzipSize?: boolean = true
: Report gzipped size if true, uncompressed size if falsemetricName: string
: The base name for the metrictags?: string[]
: Custom tags for the metric. The following tags are always added:chunk
: the chunk nametype
: the type of asset (js, css, etc)
test?: RegExp
: Test to match files against. If not set, stats for all emitted assets will be sent.