R
R
resibe2021-11-23 22:17:36
webpack
resibe, 2021-11-23 22:17:36

How to configure WebpackCompressionPlugin?

Hello, I made this vue.config.js

const CompressionWebpackPlugin = require("compression-webpack-plugin");

const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  transpileDependencies: true,

  configureWebpack: (config) => {
    Object.assign(
      config.plugins,
      new CompressionWebpackPlugin({
        test: /\.js(\?.*)?$/i,
        include: undefined,
        exclude: undefined,
        algorithm: "gzip",
        compressionOptions: { level: 9 },
        threshold: 0,
        minRatio: 0.8,
        filename: "[path][base].gz",
        deleteOriginalAssets: false,
      })
    );
  },
});

But nothing is compressed, besides, it vue inspectindicates that the compressionWebpackPlugin plugin is not initialized, which I did wrong...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex_mos, 2021-11-23
@resibe

apparently the same problem
there is such an option as I understand it just for Vue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question