first of all please excuse me for my very dummy question, but I could not find an exhaustive explanation on it. I've created a web app with React, and I've used a NPM plugin to generate both standard and Gzip compressed versions of the main.js and main.css files (originally the main.js was 1.2 Mb, with Gzip compression is around 331Kb).
So know in my "dist" folder I have:
- Index.html (that by default load standard - not compressed - main.js and main.css )
- main.js
- main.css
- main.js.gz
- main.css.gz
Well, what should I do know?
I thought I had to upload everything on my server, and modify the Index.html, so that it loaded the .gz files in place of the standard ones... but NOT! If I edit the Index.html, so to point to the gzipped files, I get an error "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/x-gzip"
With my big surprise, checking on the Network tab of the Chrome develop console, I can see in the response header of Main.js "Content encoding: gzip", and its size is 343Kb... It's not the same size as "my" compressed file, but it's not too far
So, my big question: what's going on? Does my server is automatically creating gzipped versions of my .js and .css files (it should seem like that...) ? If so, where these versions are stored? Are them created on fly from scratch each time someone request them (??) And, if so, what is the use of creating gzipped versions of the Main.js and Main.css files? What should I do with them?
Many thanks for helping me understand something!