docbrown/bin/bundleAnalyzer
Nick Taylor 2925a64eb8
Added webpack bundle analyzer (#12013)
* Added webpack bundle analyzer.

* Renamed to bundleAnalyzer (no extension)

* Added some documentation.
2020-12-22 19:13:40 -05:00

21 lines
470 B
JavaScript
Executable file

#!/usr/bin/env node
/* eslint-env node */
const webpack = require('webpack');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const config = require('../config/webpack/production');
config.plugins.push(new BundleAnalyzerPlugin());
process.env.NODE_ENV = 'production';
const compiler = webpack(config);
compiler.run((error, stats) => {
if (error) {
throw new Error(error);
}
console.log(stats); // eslint-disable-line no-console
});