Skip to content

Commit

Permalink
feat: update compression options
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnsgn committed Aug 14, 2021
1 parent 423e5c0 commit 2df3c87
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions config/plugins/assets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { join } from "path";

import imagemin from "imagemin";
import zlib from "zlib";
import webp from "imagemin-webp";
import sharp from "sharp";
import SpritesmithPlugin from "webpack-spritesmith";
Expand Down Expand Up @@ -69,10 +70,9 @@ const compression = new CompressionPlugin({
filename: "[path][base].gz[query]",
algorithm: "gzip",
// See https://nodejs.org/api/zlib.html#zlib_class_options
compressionOptions: { level: 9 },
compressionOptions: { level: zlib.constants.Z_BEST_COMPRESSION },
threshold: 0,
minRatio: 0.8,
deleteOriginalAssets: true,
exclude: /.map$/,
deleteOriginalAssets: "keep-source-map",

Expand All @@ -85,12 +85,14 @@ const compression = new CompressionPlugin({
// }

// For Brotli
// filename: "[path].br[query]",
// filename: "[path][base].br[query]",
// algorithm: "brotliCompress",
// compressionOptions: { level: 11 },
// compressionOptions: {
// params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 11 },
// },
// threshold: 10240,
// minRatio: 0.8,
// deleteOriginalAssets: false
// deleteOriginalAssets: "keep-source-map",
});

const pwa = new WorkboxWebpackPlugin.GenerateSW({
Expand Down

0 comments on commit 2df3c87

Please sign in to comment.