Kb size different on bundlephobia
websocket98765 opened this issue · 3 comments
The repo one looks just at Modal.svelte
, which is the component you would bundle with your app. (See the source code of README.md
) Bundlephobia is looking at the one of the compiled files.
Do you know which is more accurate?
More accurate in terms of what? Both are accurate but they describe different file types. If you're looking at the size of Svelte code that this package adds then you can say it adds 2.18 KB (gzipped). If you're looking at the bundled size then it might be more because .svelte
has to be translated to .js
, which will incur some overhead. But my guess is that the overhead is a one-time aspect and is neglectable (assuming you have more components than just a modal).
Does it change significantly after Svelte's build step too?
I don't know what is significant for you so I am listing some raw numbers:
Modal.svelte Size: 7.2KB
CommonJS Size: 36.31 KB (converted from .svelte
to .js
)
CommonJS Minified Size: 16.92 KB
CommonJS Gzipped Size: 5.89 KB
Again, I don't know how much overhead is added by converting from .svelte
to .js
but my guess is the overhead is a one-time thing.
Bundle size would be the one that matters. Sounds like ~5.7-5.8 kb gzip is the most realistic Kb size that it adds to a build. I appreciate the details. Thanks
The KBs that this package will add is somewhere between 2.2 and 5.8 KB because your bundler is smart enough to only include Svelte's utility functions once. However, how smart the bundle is independent of this package so I only report the size of the source code, which is 2.2 KB (gzipped).