How to use the umi-webpack-bundle-analyzer/lib/analyzer.getViewerData function in umi-webpack-bundle-analyzer

To help you get started, we’ve selected a few umi-webpack-bundle-analyzer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github umijs / umi / packages / umi-ui-tasks / src / server / util / stats.ts View on Github external
export function parseChartData(stats) {
  if (!stats) {
    return null;
  }
  let chartData;
  const analyzer = require('umi-webpack-bundle-analyzer/lib/analyzer');

  try {
    /**
     * outputPath:
     *  1. build: stats.outputPath
     *  2. dev: null
     */
    chartData = analyzer.getViewerData(stats, stats.outputPath, {
      excludeAssets: null,
    });
  } catch (err) {
    chartData = null;
  }

  if (isPlainObject(chartData) && isEmpty(chartData)) {
    chartData = null;
  }

  return chartData;
}

umi-webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis