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
Stat size, parsed size...? #61
Comments
|
Stat sizes are fetched from the webpack stats object directly, and use the actual source code of your modules as-is and report the size before minification or gzip Parsed size is calculated by reading the actual compiled bundle files and making a link back to the modules from webpack stats file. So if you use a minifier, such as UglifyJS, the parsed size shows you the size after minification. Likewise, the gzip size is calculated by reading the actual compiled bundle files and running gzip for each one of the module sources separately. Thus the gzip size shows you the size after minification and gzip, but it isn't a 1-to-1 mapping with the actual file sizes as gzipping each module separately yields less "wins" in terms of compression as the separate sources have less opportunities for gzip to compress together. Here's the relevant two lines in the code, that is ran for each module. https://github.com/th0r/webpack-bundle-analyzer/blob/v2.3.1/src/analyzer.js#L80-L83 It would be nice if you would be able to put this together into the README somehow :). This question has been asked a few times already, so it would make sense to display it in the README. |
Just one note: it gzips each module separately but also gzips the whole bundles so you will have relevant gzip sizes for your bundle scripts. |
|
Yeah true, forgot to say that for the entire bundle, the gzip size is correct, but for individual modules it might lie. Thanks for correcting me! |
|
@valscion Thanks for your answer) |
|
This is immensely helpful. Thanks for all of this detail! I'll whip up a PR to add this to the README shortly. |
|
As much as I want to write this up, I've been suffering from some sudden RSI and think it'd be better if I didn't. At least not until I see a doctor. Might be able to pick it up, but for now it's going on my back burner. Sorry! 🙈 |
|
That's entirely understandable @jmeas ❤️ no hard feelings! I understand RSI 😅 |
|
My RSI has chilled out, so I'm gonna PR this this weekend! |
|
My stat size is less the the parsed size - does it make sense? |
|
Open a new issue with more details if you think something is wrong :) |
|
I want to understand the Stat-Parsed-Gzip behavior. What should be bigger than others? |
|
It seems strange that stat size is smaller than parsed size by that big margin. You should not be able to make stat sizes smaller by changing webpack configuration as the stat size represents the original source code size as explained earlier in this issue here: #61 (comment) I can't help with figuring out why parsed size is larger than stat sizes, I'm afraid. Maybe asking in stackoverflow could allow someone to help you? |
|
@valscion Yeah, I think there is an issue with one of the libraries that I use. It imports too many icons that we're not utilizing in the UI. But I managed to optimize the bundle size using the Terser webpack plugin. My parsed bundle 13 MB became 5 :), gzipped reduced to 1.3 MB(previously 2 MB). |
|
Hello! I also experienced issues with parsed sizes being much bigger than stat sizes, but once I told my webpack to make a production build instead of a development one, this changed. While the parsed sizes of some dependencies were still bigger than the stat size, a lot of them were significantly reduced. Here's my theories about what's going on:
Anyways, these are just my guesses, I'm not sure if they're actually true. |

Are there definitions somewhere of exactly what "stat size", "parsed size," etc. means? I'd be happy to add these definitions to the README if they're somewhere else right now. Just lmk!
Thanks for the great plugin ✌️
The text was updated successfully, but these errors were encountered: