danvk / source-map-explorer

Analyze and debug space usage through source maps
Apache License 2.0
3.83k stars 101 forks source link

File-size reported at the top of the HTML file is calculated incorrectly #131

Closed IjzerenHein closed 4 years ago

IjzerenHein commented 5 years ago

Hi, first of all, awesome library, great job man! 👏 👏

I found a somewhat annoying issue. The file-size shown at the top of the HTML file is calculated incorrectly. In the following example, the bundle has a file-size of 3060595 bytes, which corresponds to 2.918.. Megabytes. The header however shows 3.06.

image

image

It seems it is dividing by 1000000, but it should divide by 1024 * 1024.

danvk commented 5 years ago

I thought we fixed this in #54.

Update: looks like it was changed to default to base 10, not base 2. @nikolay-borzov do you remember why this changed?

https://github.com/danvk/source-map-explorer/blob/b08a1ad3e3fb1d4fac1671a50310c62492d901a7/src/helpers.ts#L15

nikolay-borzov commented 4 years ago

Don't remember. Maybe it's a migration issue. I'l fix it