So, I noticed that we were getting very slow initial page loads in our production website. I then read somewhere that running meteor run --production
can speed up the initial load. So I tried that locally, and the main js
file was reduced considerably. However, we are deploying as a Node app via meteor build --directory ~
and then node main.js
. The main js
file in this build is over 4x as large, causing the initial load to be 4x as slow. What do I need to do to make that production build as lean as the files being server in meteor run --production
? I have searched this forum and Googled for the answer but haven’t seen anything very clear. Any suggestions?
To answer the question, meteor build
creates a bundle with non-gzipped files. If you are running Meteor as a Node app, you need to gzip the .js and .css files, and then enable either static or on-the-fly gzipping to the browser in nginx or whatever you use. Here are some useful articles that helped us:
http://nginx.org/en/docs/http/ngx_http_gzip_module.html
2 Likes
Hi, I tried this command “meteor build --directory” in my apps and found the package is minified while without --debug option . It’s the same size as the --production option. So i think that’s not a problem.