pastelsky / bundlephobia

🏋️ Find out the cost of adding a new frontend dependency to your project
https://bundlephobia.com
MIT License
8.96k stars 221 forks source link

inaccurate size: @popperjs/core reports incorrect size #286

Open FezVrasta opened 4 years ago

FezVrasta commented 4 years ago

Package name

@popperjs/core

Entire (stringified) error that I see in my browser console

Bundlephobia reports @popperjs/core weights 6.3kB gzipped, but actually its gzipped size is 5.76kB (for the UMD bundle specified as main)

atomiks commented 4 years ago

This is the size of @popperjs/core by itself with webpack. In Rollup, it's ~550 B smaller.

However, we also figured out that if you import Popper along with a dependency, for example React, the "added cost" ends up being smaller in webpack, likely due to the way webpack and/or gzip works with additional dependencies or code, or perhaps webpack's runtime overhead is ignored which Bundlephobia includes(?).

It'd be useful to also show the bundle size with Rollup as well as webpack, or webpack's along with an added dependency like React to figure out the "practical added cost", since that's how it will be used in practice.

Also switching brotli compression instead of gzip may be helpful; services like UNPKG use it since 2018 to serve files.