Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why angular-cli webpack in folder dist (-prod) has gzip files as well as not gzip files

I am interested in Angular-cli structure. When I build prod, (ng build -prod) I got folder dist where I found same files, just one of them is gzip, another is not.

Structure folder /dist:

enter image description here

Do I need gzip files or not? or maybe instead of gzip I do not need just JS files. Why do I have to hold two copies of the files?.

My folder gets more weight because of that. Could you explain to me how this works?

like image 458
Dmitrii Goriunov Avatar asked Aug 14 '16 00:08

Dmitrii Goriunov


1 Answers

Update

Gzip generation has been removed the Angular CLI because it was confusing to many people, and now the CLI only outputs the files you actually use.

For more information, check out the official ng build documentation.

The gz files exist so you can check the real size the js files will have when sent to the browser. Because you are almost definitely going to use GZIP on the server.

You can skip generating them by adding --suppress-sizes true.

That will remove most of them. There's a bug that makes it leave one gz still, which you can still workaround by adding --vendor-chunk false.

You can see more optimizations and get the context from my comment on this issue in the Angular CLI repository.

like image 179
Meligy Avatar answered Oct 20 '22 22:10

Meligy