Skip to content

Human readable file size in bundle analyzer report#7766

Merged
devongovett merged 7 commits into
parcel-bundler:v2from
solstice23:human-readable-size
Mar 11, 2022
Merged

Human readable file size in bundle analyzer report#7766
devongovett merged 7 commits into
parcel-bundler:v2from
solstice23:human-readable-size

Conversation

@solstice23

Copy link
Copy Markdown
Contributor

↪️ Pull Request

Make file sizes readable in the bundle analyzer report.

💻 Examples

image
image

@height

height Bot commented Feb 26, 2022

Copy link
Copy Markdown

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Comment thread packages/reporters/bundle-analyzer/client/index.js Outdated
Co-authored-by: Kid <44045911+kidonng@users.noreply.github.com>
@mischnic

Copy link
Copy Markdown
Member

I think there should be some decimal places, like the Webpack bundle analyzer has: https://www.npmjs.com/package/webpack-bundle-analyzer

And in that regard, why not use filesize directly instead of handcoding that?

> require("filesize")(100000)
'97.66 KB'

@kidonng

kidonng commented Feb 28, 2022

Copy link
Copy Markdown
Contributor

And in that regard, why not use filesize directly instead of handcoding that?

This script runs in the browser, so probably not worth the hassle to vendor an extra library.

@solstice23

Copy link
Copy Markdown
Contributor Author

The report is a single HTML file, so it might be better to calculate it without extra library.
Now it is rounded to 2 decimal places, same as the behavior of the filesize.

Comment thread packages/reporters/bundle-analyzer/client/index.js Outdated

@mischnic mischnic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! (I missed that this parts runs in the browser 👍 )

@devongovett devongovett merged commit ef16fad into parcel-bundler:v2 Mar 11, 2022
@solstice23 solstice23 deleted the human-readable-size branch March 12, 2022 06:37
gorakong pushed a commit that referenced this pull request Nov 3, 2022
* upstream/v2:
  Upgrade Flow to 0.174.1 (#7849)
  v2.4.0
  v2.4.0 changelog
  Bump Parcel CSS
  Dynamic imports priority fix closes #6980 (#7061)
  fix(transformers): errors.map is not a function (#7672)
  Make NodeResolver check realpath before resolving with `source` entry (#7846)
  docs: fix wrong location documents (#7689)
  Fix: escape double quote of url value in CSS `url()` (#7718)
  Update @parcel/css and add diagnostic for url dependencies in custom properties (#7845)
  Use relative path for bundle labels in bundle analysis (#7737)
  Allow use react-jsx transform in React 16.14.0 (#7728)
  Move to @parcel/css by default (#7821)
  Feature: pick PORT number also from .env file (#7819)
  Enable parsing static initialization blocks (#7839)
  Bump swc and prevent pure comment removal (#7833)
  Bump swc (#7777)
  Human readable file size in bundle analyzer report (#7766)
  Improve emoji support detection (#7775)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants