Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for always showing gzip diff #20

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ For example, if you build to `dist`, you should:

(Optional, defaults to `0`) The threshold under which pages will be considered unchanged. For example, if `minimumChangeThreshold` was set to `500` and a page's size increased by `300 B`, it will be considered unchanged.

### `alwaysShowGzipDiff (boolean)`

(Optional, defaults to `false`) If set, the display table will show the gzip size difference for routes even when a budget is set.

## Caveats

- This plugin only analyzes the direct bundle output from next.js. If you have added any other scripts via the `<script>` tag, especially third party scripts and things like analytics or other tracking scripts, these are not included in the analysis. Scripts of this nature should _probably_ be loaded in behind a consent manager and should not make an impact on your initial load, and as long as this is how you handle them it should make no difference, but it's important to be aware of this and account for the extra size added by these scripts if they are present in your app.
Expand Down
2 changes: 1 addition & 1 deletion compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function renderSize(d, showBudgetDiff) {
const gzd = d.gzipDiff
const percentChange = (gzd / d.gzip) * 100
return ` | \`${filesize(d.gzip)}\`${
gzd && !showBudgetDiff
gzd && (options.alwaysShowGzipDiff || !showBudgetDiff)
? ` _(${renderStatusIndicator(percentChange)}${filesize(gzd)})_`
: ''
}`
Expand Down