2

When I generated the angular(7) production build with ng build --prod then generated main chunk size is 522 KB so I think is it is very large as I have very small application. So my question is how to generate build with content-encoding: gzip? or Is there any other angular compression library I need to use?

See the below snapshot for more details.

content-encoding: gzip example

enter image description here

Generated production build snapshot

enter image description here

Vijay
  • 171
  • 2
  • 11
  • Possible duplicate of [how to enable compression in angular](https://stackoverflow.com/questions/44758755/how-to-enable-compression-in-angular) – bryan60 Jul 28 '19 at 17:08
  • 2
    You can use any gzip compression library (or just the gzip command-line utility) to pre-compress the file. But you'll have to configure your server to serve the pre-gzipped file with the correct headers instead of the requested JS file. And servers are usually able to gzip responses all by themselves. So, read the documentation of your web server to know how to configure gzip compression. – JB Nizet Jul 28 '19 at 17:17
  • @JBNizet Thanks for the reply. Can you please suggest gzip compression library? – Vijay Jul 28 '19 at 17:48
  • 1
    No. But as I said, there should be no need to pre-compress JS files. Just configure your web server to do it for you. And if you just want to check what size will a file be once compressed, just use `gzip file`. – JB Nizet Jul 28 '19 at 17:50
  • @JBNizet Thanks. I will try this. – Vijay Jul 28 '19 at 17:59

0 Answers0