Webpack gzip vs express gzip

I really wanted to know the differences between webpack gzip and express gzip

I used only express gzip using compression . Like this,

app.use(compression());

But seo analyzer says that I can compress javascript files more, although I can see Content-Encoding: gzip in the Chrome chrom devtools console of my home page . So I started looking for ways to compress files, and I found a compression package-webpack-plugin that creates gzip files. I already use webpack, but not compression-webpack-plugin. I am thinking of adding this plugin if it helps to compress my files more.

Questions:

  • Do I need express and webpack gzip packages, or just one?
  • What is the difference between webpack gzip and express gzip?
+4
source share
1 answer

The difference is that Webpack compression compresses your files one - time - at build time. These compressed versions are then saved to disk.

Express plugins, on the other hand, compress your files at the request point . Some packages may have built-in caching, so performance limits occur only once (or rarely), but usually the difference is that this will happen when the HTTP request is answered.

zip , - (, Nginx) gzip , Node ( C).

- Webpack .gz . , express-static-gzip, , gzipping . , Node.js HTTP-, / .

Webpack , ( , , ), , , , HTTP, , .

+6

Source: https://habr.com/ru/post/1649147/


All Articles