bundleAnalyzerPlugin.js 431 Bytes
const { BundleAnalyzerPlugin } = require('../compiled/webpack-bundle-analyzer');

module.exports = async function addBundleAnalyzerPlugin(opts) {
  const { config } = opts;
  config.plugin('webpack-bundle-analyzer').use(BundleAnalyzerPlugin, [
    {
      analyzerMode: 'server',
      analyzerPort: process.env.ANALYZE_PORT || 8888,
      openAnalyzer: false,
      logLevel: 'info',
      defaultSizes: 'parsed',
    },
  ]);
};