mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix writing stats to the file
This commit is contained in:
@@ -264,13 +264,19 @@ function getPlugins(
|
||||
// Record bundle size.
|
||||
sizes({
|
||||
getSize: (size, gzip) => {
|
||||
Stats.currentBuildResults.bundleSizes.push({
|
||||
const currentSizes = Stats.currentBuildResults.bundleSizes;
|
||||
const recordIndex = currentSizes.findIndex(
|
||||
record =>
|
||||
record.filename === filename && record.bundleType === bundleType
|
||||
);
|
||||
const index = recordIndex !== -1 ? recordIndex : currentSizes.length;
|
||||
currentSizes[index] = {
|
||||
filename,
|
||||
bundleType,
|
||||
packageName,
|
||||
size,
|
||||
gzip,
|
||||
});
|
||||
};
|
||||
},
|
||||
}),
|
||||
].filter(Boolean);
|
||||
|
||||
Reference in New Issue
Block a user