1

I have simple VueJs application with webpack and in webpack.prod.conf.js file, I have enabled productionGzip which generates .gz file for each of the chunks in dist folder.

productionGzip: true,
productionGzipExtensions: ['js', 'css'],

When I am loading my application in browser, I can see .js files are loaded but I can not see any tag with content-encoding: gzip or anything which indicates .gz files has taken effects. All .js files loaded in network tab of browser are having Content-Type: application/javascript

How to verify if .gz files are loading in chrome browser?

skubal
  • 23
  • 4

1 Answers1

0

It depends on how your server is serving static files.

As an example, I use the simple node http-server package to test the production build.

-g or --gzip When enabled (defaults to false) it will serve ./public/some-file.js.gz in place of ./public/some-file.js when a gzipped version of the file exists and the request accepts gzip encoding.

So I run http-server --gzip ./dist to serve the compiled files.

With nginx, you need the HttpGzipStatic module and to put gzip_static on; in your config. (source)


Do you know how to configure IIS for this case?

It's doesn't look as straightforward to configure IIS to serve pre-compressed files, but it's easy to tell IIS to compress static files so you could set the productionGzip option to false and let IIS do the work.

Angular's PRE-Gzipped files are not served via IIS? or this ASP.Net issue.

Emile Bergeron
  • 14,368
  • 4
  • 66
  • 111
  • Thanks for response. In my case, I am using IIS. Do you know how to configure IIS for this case? – skubal Apr 23 '18 at 07:27
  • @skubal I don't use IIS and it looks like it's not as straightforward, but there's a lot of answers on this already on SO. – Emile Bergeron Apr 23 '18 at 14:24