Skip to content
This repository was archived by the owner on Aug 24, 2023. It is now read-only.

Commit 49b28af

Browse files
committed
docs: fixed setting compression level for brotliCompress.
Fixes webpack-contrib#154. Signed-off-by: Adrian Pedziwiatr <180254@users.noreply.github.com>
1 parent 6aa8e38 commit 49b28af

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ module.exports = {
401401
algorithm: 'brotliCompress',
402402
test: /\.(js|css|html|svg)$/,
403403
compressionOptions: {
404-
// zlib’s `level` option matches Brotli’s `BROTLI_PARAM_QUALITY` option.
405-
level: 11,
404+
params: {
405+
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
406+
},
406407
},
407408
threshold: 10240,
408409
minRatio: 0.8,
@@ -412,7 +413,8 @@ module.exports = {
412413
};
413414
```
414415

415-
**Note** The `level` option matches `BROTLI_PARAM_QUALITY` [for Brotli-based streams](https://nodejs.org/api/zlib.html#zlib_for_brotli_based_streams)
416+
**Note** Brotli’s `BROTLI_PARAM_QUALITY` option is functionally equivalent to zlib’s `level` option.
417+
You can find all Brotli’s options in [the relevant part of the zlib module documentation](https://nodejs.org/api/zlib.html#zlib_class_brotlioptions).
416418

417419
### Multiple compressed versions of assets for different algorithm
418420

@@ -435,7 +437,9 @@ module.exports = {
435437
algorithm: 'brotliCompress',
436438
test: /\.(js|css|html|svg)$/,
437439
compressionOptions: {
438-
level: 11,
440+
params: {
441+
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
442+
},
439443
},
440444
threshold: 10240,
441445
minRatio: 0.8,

0 commit comments

Comments
 (0)