Skip to content

Commit

Permalink
Merge pull request #9 from github/avoid-threshold-check
Browse files Browse the repository at this point in the history
Avoid threshold check
  • Loading branch information
mattcosta7 authored Jan 10, 2022
2 parents 0ee7231 + ebee798 commit fb1ebe3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 2 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions src/get-stats-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type StatDiff = {
diff: number
diffPercentage: number
}

function indexNameToSize(
statAssets: StatsCompilation['assets'] = []
): Record<string, number> {
Expand Down Expand Up @@ -77,13 +78,9 @@ function webpackStatsDiff(
} else {
const diff = {name, ...createDiff(oldAssetSize, newAssets[name])}

/**
* Providing a small threshold for the diff to be considered "bigger"/"smaller"
* to account for minor variance in webpack output for the same asset.
*/
if (diff.diffPercentage > 5) {
if (diff.diffPercentage > 0) {
bigger.push(diff)
} else if (diff.diffPercentage < -5) {
} else if (diff.diffPercentage < 0) {
smaller.push(diff)
} else {
unchanged.push(diff)
Expand Down

0 comments on commit fb1ebe3

Please sign in to comment.