Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}