We are improving our pagespeed score and the biggest challenge that we are facing now is the big JS bundle being downloaded.
Our hypothesis is that we can cut into downloading and parsing time by not concatenating the JS files into one large file similar to development (parallel downloads through request multiplexing). We still wanted minification to happen though.
Is there an easy way to do this in production?
It would be possible by replacing standard-minifier-js
with a custom minifier. Minifiers receive all of the linked files (one for the app, one for each package, and one for the app’s npm dependencies) in the main bundle: https://github.com/meteor/meteor/blob/d9c6bde7e840bdad4e31c5f367e208841364b2ef/packages/standard-minifier-js/plugin/minify-js.js#L13. Most meteor minifiers will keep all files separate during development and concatenate them for production, but any combination is possible as long as the load order is preserved.
Chrome and possibly other web browsers do perform better with multiple small bundles instead of one large bundle. If using only the minifier doesn’t have enough flexibility for this, we could look into modifying Meteor’s linker to output multiple smaller files if it has enough of a benefit, but this would be a larger project.
Seems this is the case and we wanted to test this hypothesis.
Thanks @zodern for pointing me to the right direction. I’ll start with the file you mentioned