cenfun / webpack-stats-report

Generating Webpack Stats Report in HTML Grid

Home Page:https://cenfun.github.io/webpack-stats-report/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webpack Stats Report

Generating Webpack Stats Report in HTML Grid.

npm npm

Preview Example Reports

Install

npm i webpack-stats-report -D

Usage

As a webpack plugin

// 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

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

//default options
{
    title: "Stats Report",
    output: "stats-report.html",
    outputStatsJson: false,
    gzipSize: false
    ...
}

more details: options.js

Test

npm run test

see test/test.js

Changelog

see CHANGELOG.md

About

Generating Webpack Stats Report in HTML Grid

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

License:MIT License


Languages

Language:JavaScript 50.9%Language:Vue 38.8%Language:SCSS 8.1%Language:HTML 2.1%Language:CSS 0.1%