Skip to content
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

Huge discrepancy for minified size? #31

Open
wmertens opened this issue Mar 14, 2017 · 4 comments
Open

Huge discrepancy for minified size? #31

wmertens opened this issue Mar 14, 2017 · 4 comments

Comments

@wmertens
Copy link

I was puzzled by the fact that my react-dom dependency is 506KB raw and 200KB minified, while the official build is 600KB raw and 120KB minified.

I tried comparing minification settings etc before thinking of simply creating an entry with only react-dom. That one has the minified react-dom at 109KB, much nicer and to be expected from tree shaking vs the full minified build.

So now I wonder, what causes the discrepancy between the minified size in my app.js vs the react-dom-only entry? Is there actually more code in the react-dom in my app.js? Are parts counted differently? All the minified sizes do seem to add up to the full minified size…

@wmertens
Copy link
Author

Oh wow, I just found out that the minified size is just the proportion of the output bundle. In the case of React that is very inaccurate because a lot of code is snipped when compiling for production.

I was thinking that the minified sizes were a reasonable estimate, but that is not the case here.

So maybe the warning about the minified size should be changed to be "minified sizes are an estimation based solely on the raw size".

@iAdramelk
Copy link

+1 here. Tried to debug the same situation. React in app bundle size was 60kb, size of react in separate bundle was 20kb.

Made line by line comparison of each file in the minimised bundle. Result:

  1. There was indeed some additional files added by react-addons which added 14kb.
  2. But each of the common file was exactly the same size and length.

So full size must be 34kb, not 60kb. Same results as @wmertens for react-dom. Even worse for lodash.

@littlebee
Copy link

+1 My bundle visualization says react-dom is 2M actual / 512.1k raw I can't correlate that to what I see in node_modules/react-dom/dist:
bwilkerson@IT-SEA14730-MBP:~/projects/zulily/htdocs_ems$ ls -lh app/v7/node_modules/react-dom/dist/
total 2904
-rw-r--r-- 1 bwilkerson CORP\Domain Users 560K Jun 14 17:00 react-dom-server.js
-rw-r--r-- 1 bwilkerson CORP\Domain Users 123K Jun 14 17:00 react-dom-server.min.js
-rw-r--r-- 1 bwilkerson CORP\Domain Users 638K Jun 14 17:00 react-dom.js
-rw-r--r-- 1 bwilkerson CORP\Domain Users 127K Jun 14 17:00 react-dom.min.js

webpack_visualizer

@jskorepa
Copy link

I think that this is same issue as webpack-contrib/webpack-bundle-analyzer#161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants