An open API service indexing awesome lists of open source software.

https://github.com/cenfun/webpack-stats-report

Generating Webpack Stats Report in HTML Grid
https://github.com/cenfun/webpack-stats-report

grid report stats webpack webpack-plugin

Last synced: about 1 year ago
JSON representation

Generating Webpack Stats Report in HTML Grid

Awesome Lists containing this project

README

          

# Webpack Stats Report
> Generating [Webpack](https://github.com/webpack/webpack) [Stats](https://webpack.js.org/api/stats/) Report in HTML Grid.

![npm](https://img.shields.io/npm/v/webpack-stats-report)
![npm](https://img.shields.io/npm/dt/webpack-stats-report)

## Preview Example Reports
* [stats-report-wsr.html](https://cenfun.github.io/webpack-stats-report/stats-report-wsr.html)
* [stats-report-test.html](https://cenfun.github.io/webpack-stats-report/stats-report-test.html)

## Install
```sh
npm i webpack-stats-report -D
```
## Usage

### As a webpack plugin
```js
// 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"
})]
};
```

### As a Node API
```js
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
})
});
});
```

## Options
```js
//default options
{
title: "Stats Report",
output: "stats-report.html",
outputStatsJson: false,
gzipSize: false
...
}
```
more details: [options.js](lib/options.js)

## Test
```sh
npm run test
```
see [test/test.js](test/test.js)

## Changelog
see [CHANGELOG.md](CHANGELOG.md)