npm i webpack-stats-report -D
// webpack.config.js
const StatsReportPlugin = require("webpack-stats-report").StatsReportPlugin;
module.exports = {
// ... configuration settings here ...
plugins: [new StatsReportPlugin({
//options
title: "Stats Report - webpack-stats-report",
output: ".temp/stats-report.html"
})]
};
const webpack = require('webpack');
const StatsReportGenerator = require("webpack-stats-report").StatsReportGenerator;
webpack(webpackConfig, async (err, stats) => {
await StatsReportGenerator({
//options
title: "Stats Report - webpack-stats-report",
output: ".temp/stats-report.html",
//require one more option stats
stats: stats.toJson({
//source for gzipSize = true
source: true,
reasons: false,
chunkModules: false
})
});
});
//default options
{
title: "Stats Report",
output: "stats-report.html",
outputStatsJson: false,
gzipSize: false
...
}
more details: options.js
npm run test
see test/test.js
see CHANGELOG.md