next-bundle-analyzer
Version:
NextJS version of Webpack Bundle Analyzer.
22 lines (19 loc) • 977 B
JavaScript
;
function updateGroups(groups, stats) {
var _a, _b;
const modules = (_b = (_a = stats.chunks) === null || _a === void 0 ? void 0 : _a.map((chunk) => chunk.modules)) === null || _b === void 0 ? void 0 : _b.flat();
groups.forEach((group) => {
var _a, _b, _c;
if (group.id !== undefined) {
delete group.id;
}
const issuers = (_c = (_b = (_a = modules === null || modules === void 0 ? void 0 : modules.find((module) => (module === null || module === void 0 ? void 0 : module.name) === group.path)) === null || _a === void 0 ? void 0 : _a.issuerPath) === null || _b === void 0 ? void 0 : _b.map(({ name }) => name)) === null || _c === void 0 ? void 0 : _c.filter(Boolean);
if (issuers && issuers.length > 0) {
group.issuers = issuers;
}
if (group.groups !== undefined) {
updateGroups(group.groups, stats);
}
});
}
exports.updateGroups = updateGroups;