Skip to content

Commit

Permalink
refactor(webpack): split filter and reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiode committed Mar 2, 2021
1 parent 630fe47 commit 9ed63c5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/webpack/lib/plugins/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ const formatWarning = (name, duration, assets, isRebuild) => {
};

const formatSuccess = (name, duration, assets, isRebuild) => {
const totalSize = Object.values(assets).reduce((sum, asset) => {
return sum + (asset.name.endsWith('.map') ? 0 : asset.size);
}, 0);
const totalSize = Object.values(assets)
.filter((asset) => !asset.name.endsWith('.map'))
.reduce((sum, asset) => {
return sum + asset.size;
}, 0);
const message = `bundling '${name}' finished after ${duration} (${prettyBytes(
totalSize
)})`;
Expand Down

0 comments on commit 9ed63c5

Please sign in to comment.