How do you enable gzip compression on the webpack-dev-server? It doesn't appear to be on by default.
Gzip on Windows Servers (IIS Manager)Open up IIS Manager. Click on the site you want to enable compression for. Click on Compression (under IIS) Now Enable static compression and you are done!
Since static compression involves compressing files ahead of time, webpack settings can be modified to compress assets as part of the build step. CompressionPlugin can be used for this. By default, the plugin compresses the build files using gzip .
Double click on the file and select headers. Under 'Response headers' you are looking for the 'Connection-Encoding' field, it will say gzip if it is enabled. NOTE: By default, Deflate is enabled on all of our servers.
webpack.config.jsconst CompressionPlugin = require("compression-webpack-plugin"); module. exports = { plugins: [new CompressionPlugin()], }; And run webpack via your preferred method.
1) Insert this line before app.use(require('webpack-dev-middleware')...
:
app.use(express.compress());
2) According to source code there is undocumented option compress
:
$ webpack-dev-server ... --compress
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With