github / webpack-bundlesize-compare-action

A github action that outputs bundlesize comparison tables for pull requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add describe for getting gzip describe in total

hasot opened this issue · comments

In Common total hard to understand how I can get gzip total. After couple hours I could understand what for getting gzip size describe I must compress all my files with compression-webpack-plugin. I don't have permission in your repository and can't create PR, but pls add help describe for other people

example from readme which I created but cannot create PR:

In your application, if you want to add gzip size in total, you will need to create gzip files from your project.

For example, you should add minRatio: Infinity in compression-webpack-plugin for get it because default value for minRatio: 0.8

// webpack.config.js
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')

// optionally you can also output compressed/gzipped stats. Requires a version >=1.1.0
const CompressionPlugin = require('compression-webpack-plugin')

module.exports = {
  plugins: [
    ...plugins,
    // not required
      new CompressionPlugin({
          test: /\.(js|css|json)(\?.*)?$/i,
          algorithm: 'gzip',
          minRatio: Infinity,
      }),

    // required
    new BundleAnalyzerPlugin({
      // generate the stats.json file
      generateStatsFile: true
      
    })
  ]
}