-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Feature: Check against total file size #205
Comments
Thanks for taking the time! bundlesize tries to shy away from total size because the performance of a page depends a lot on the way the individual bundles load (prefetch/lazy-load/on-demand, etc.) We've had discussions around One strategy that has worked for teams using bundlesize is to measure initial bundles and chunks with different thresholds: "bundlesize": [
{ "path": "./dist/feature-*.js", "maxSize": "30 kB"},
{ "path": "./dist/chunk-*.js", "maxSize": "5 kB" }
] Let me know if that's a satisfactory answer, I can talk about this in more detail if you'd like |
@siddharthkp Thanks for that fast answer! I understand now why the measurement of individual files makes more sense than measure the total file size. |
Total size makes sense for setting a library size budget for an npm package you publish, but where you don't want to bundle the package and leave bundling to consumers. Sure the consuming application could cherry-pick & tree-shake the code paths unused, but as a library author it still makes sense to measure & set budgets for the code published in an npm package. To achieve this I'm resorting to rollup to generate a bundle for me, and then I run |
@vanslly that's great implementation, thanks for leaving it here |
Do you want to request a feature or report a bug?
A feature
What is the current behavior?
Bundlesize currently checks if each file is below the threshold.
What is the expected behavior?
With a flag set (e.g.
checkAgainstTotal
), bundlesize should sum up the size of all (selected) files and check it against a threshold.If this is a feature request, what is motivation or use case for changing the behavior?
In times of code splitting, it can happen that you have 100 files <3kb, but in the end, this still means that the app is large.
The text was updated successfully, but these errors were encountered: