This is a working fork of the unmaintained webpack-visualizer-plugin
It works with webpack 5.x
npm i -D webpack-visualizer-plugin2
This will generate the statistics page in /stats/ folder NOTE: "filename" points to the webpack output path, not the project root path
const Visualizer = require('webpack-visualizer-plugin2');
module.exports = {
plugins: [
new Visualizer({
filename: path.join('..', 'stats', 'statistics.html'),
throwOnError: true
}),
],
}