Registry / devops / webpack-stats-report

webpack-stats-report

JSON →
library2.0.6jsnpmunverified

Version 2.0.6 (active, monthly releases). Generates an HTML grid report from Webpack stats JSON, useful for visualizing bundle composition and size. Key differentiators: lightweight, no external dependencies, supports gzip size display, works both as a Webpack plugin and standalone Node API. Unlike webpack-bundle-analyzer, it produces a single static HTML file with grid layout.

npm install webpack-stats-report
INSTALL
IMPORT
SIG · WEBPACK-STATS-REPO
W
webpack-stats-report
devopsjavascriptv2.0.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StatsReportPlugin
const { StatsReportPlugin } = require('webpack-stats-report')
const StatsReportPlugin = require('webpack-stats-report')
Named export – default require will return the whole module object, not the class.
StatsReportGenerator
const { StatsReportGenerator } = require('webpack-stats-report')
import { StatsReportGenerator } from 'webpack-stats-report'
Package uses CommonJS; ESM imports may not work in Node <12 or without 'type':'module'.
StatsReportPlugin
import { StatsReportPlugin } from 'webpack-stats-report'
import StatsReportPlugin from 'webpack-stats-report'
Default import is the module object, not the class. Use named import for the plugin.

Minimal Webpack config to generate a stats report HTML file with gzip sizes. Shows the plugin import and basic options.

const { StatsReportPlugin } = require('webpack-stats-report'); module.exports = { // ... other webpack config plugins: [ new StatsReportPlugin({ title: 'My Bundle Report', output: './reports/stats-report.html', gzipSize: true, outputStatsJson: './reports/stats.json' }) ] };
Debug
Known issues
gotchaWhen using gzipSize: true, Webpack stats must include the 'source' property – stats.toJson({ source: true }).
fix
Ensure the stats object passed to StatsReportGenerator has source: true, or it will silently omit gzip sizes.
affects: >=0.0.0
deprecatedThe default import (require('webpack-stats-report')) returns the entire module object, not StatsReportPlugin or StatsReportGenerator.
fix
Use named destructuring: const { StatsReportPlugin } = require('webpack-stats-report')
affects: >=1.0.0
gotchaThe package uses CommonJS (require). Using ES import syntax may fail in older Node versions or when 'type':'module' is not set.
fix
Use require() in Node <12; or ensure 'type':'module' in package.json and use import {} from syntax.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: StatsReportPlugin is not a constructor
Default import of the module object instead of named import.
fix
Use const { StatsReportPlugin } = require('webpack-stats-report');
gzip size shows 0 B even though assets have content
Stats JSON missing 'source' property.
fix
When calling stats.toJson(), pass { source: true }.
TypeError: StatsReportGenerator is not a function
Incorrect import: using require('webpack-stats-report') and then calling it as StatsReportGenerator().
fix
Use const { StatsReportGenerator } = require('webpack-stats-report');
Upgrade
Version history
2.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources