-
Notifications
You must be signed in to change notification settings - Fork 21
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
support async load module info when click module tab #3009
Comments
Thanks for opening the issue @hardfist! I am aware of the modules tab performance issue when there are > 5K entries, the list is processed for each run and then compared and rendered. I've been looking recently at possible ways to improve the processing or optimize the rendering (ex: show only the first 100 entries). I will try to pick it up next week and see if there is anything I can do short-term. I would appreciate it if you could share the webpack stats (here or send it to the email on my profile). For reference, how many modules does your project have?
Do you mean the resulting bundle-stats report or the original webpack-stats JSON file? |
we have more then 10K+ modules and the original webpack-stats json file is bigger than 70M |
I tried to use zlib to compress stats.json which reduce size from 70M to 3M, which may be helpful |
@hardfist if the size of the webpack stats JSON file is a concern for you, you can try to export only the webpack stats that are needed for bundle-stats. Here is an example with webpack-stats-plugin, the plugin gives more control when there are other plugins or configs that are altering the default webpack stats options: webpack-stats-plugin: Output webpack stats It depends on many factors, but based on existing usage, the webpack-stats for a project with 1-2K modules is around 250KB, and for a project with 6K is ~ 1MB, I think that if you manage to update the webpack-stats generation, your JSON file should be less than 5MB. |
I send the stats.json to your email, I already tried to minimize the stats.json but it is still too large |
Thanks for sharing the webpack stats @hardfist! I think that's the minimum size that you can generate using webpack stats options, most of the data is module entries: # Size in bytes
cat stats.json | jq '.' | wc -c
> 83136327 # 83MB
# Modules data size in bytes
cat stats.json | jq '.modules' | wc -c
> 79999569 # 80MB
## Module count
cat stats.json | jq '.modules | length'
> 16085 Filtering the module properties based on the ones extracted by bundle-stats, the result is ~ cat stats.json | jq '.modules[] | .name, .size, .chunks, .modules' | wc -c
3485193 # 3.5MB The largest data is held by cat stats.json | jq '.modules[] | .issuerPath' | wc -c
> 34084164 # 34MB
cat stats.json | jq '.modules[] | .reasons' | wc -c
> 27531760 # 27.5MB If you want to make the JSON file smaller, you can remove To remove the data from the webpack stats you can use webpack-stats-plugin transform function or a tool like jq: cat stats.json | jq '.modules[] |= del(.issuerPath, .reasons)' > stats.filtered.json
cat stats.filtered.json | jq '.' | wc -c
> 13995308 # 14MB |
@hardfist, if you have the chance, please install Long term, I think |
thanks, i will give it a try |
@vio it did reduce bundle-stats.html to 11M, thanks a lot |
It's still large because bundle diff html is twice size of bundle-stats which is 20M, it seems we may need compression and lazy load to solve this problem |
@hardfist you mean that when you are generating the bundle-stats report with a baseline, the resulting html is 20MB and that is loading slow when trying to load from a web server? Feel free to explain your full workflow in case I didn't get it right ;) |
yes we use bundle-stats in our company to build things like relative-ci, which will send build stats json and build stats html to cdn for every Merge Request and generate bundle-stats diff for mr source branch and master branch, and it turns the diff page size is twice of webpack stats size, since it contains both source branch stats info and master branch stats info |
Yes, the report is inlining the job data for the current report and baseline. The normalized data is usually larger than the webpack stats source and looks like, in your case, the modules size is almost 2x the source size. I think that's something that needs to be optimized, will try to have a look. Also, the normalized data includes a copy of the webpack stats data ( Since the document is html, i think is recommended to enable compression, the transfer size can decrease quite a lot: zip bundle-stats.zip dist/bundle-stats.html
> adding: dist/bundle-stats.html (deflated 92%) |
here is a way to optimize the webpack-stats JSON file to the minimum required (will not impact the size of bundle-stats html report): https://relative-ci.com/documentation/guides/webpack-stats/webpack-stats-plugin/#optimize-the-webpack-stats-json-file-size |
thank you for your suggestion, i will try it later |
@hardfist Going to close the issue for now, but feel free to reopen it if you have any issues. |
in our application bundle-stats index.html contains module takes 70M size, which is too big too show, so I wonder whether we could lazy load module info when click module analyze tab
The text was updated successfully, but these errors were encountered: