Surprise bundle size with bundle-visualizer

Hello there,

I tried to check the size of my starter project with the bundle-visualizer package.

I used the command meteor --extra-packages bundle-visualizer --production and my packages include

standard-minifier-css@1.3.4   # CSS minifier run for production mode
standard-minifier-js@2.1.1    # JS minifier run for production mode

But as you can see in the image below, my react-dom is around 195kB, but if I open node_modules\react-dom\dist I can find that it is supposed to be 128kB minified.
jQuery is 96.5kB which is big but consistent with its minified version, and react itself is around 40kB.

For those interested, jagi:astronomy is 178kB and viewmodel-react is 50.2kB.
image
With everything together it’s already 1MB.
The question is: what to do for react-dom, and is my bundle-size optimizable ?

I have eliminated jQuery from my react project and I used code splitting to reduce my bundle size. Preact seems like a reasonable alternative to react if you want to further reduce your bundle size.

I don’t think it’s reasonable to use code splitting on main packages like react-dom package though…

Yeah I don’t even think that’s doable. I used code splitting for speed up the initial load by deferring the non-critical parts of the app. I also have react-dom in my initial bundle along with react-bootstrap which is also big. For the react-dom the only solution I found is to use preact.

I will bring some elements to the discussion:

I stumbled upon https://mathiasbynens.be/demo/jquery-size

As you can see, it looks like meteor --production does minify but not gzip (this is for meteor deploy maybe?)

I don’t know much about this kind of optimization, so it would be good if someone more knowledgeable could explain.

Does gzipping files come with another performance cost (time to extract?)

I would be happy to know more

But as you can see in the image below, my react-dom is around 195kB, but if I open node_modules\react-dom\dist I can find that it is supposed to be 128kB minified.

There is already an issue about this topic, but still no clean solution in sight, might help https://github.com/meteor/meteor/issues/6402#issuecomment-301090494