webpack-contrib/compression-webpack-plugin

compress images not work

linxiaowu66 opened this issue · 2 comments

config as below:

new CompressionWebpackPlugin({
        test: /\.(js|mjs|json|obj|mtl|png)$/i,
        deleteOriginalAssets: true,
      }),

And I also config the image with url-loader:

{
        test: /\.(png|jpg|gif|svg|jpeg)$/i,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 8192,
            },
          },
        ],
      },

Then all images below 8192 Byte will be compile to base64 embeded in the js file, however there are two images are bigger than 8192 Byte(one is 15KB, another is 55KB), so I think them will be compressed with this plugin, but not work.

I use these image just below:

import EmptyPng from 'assets/images/empty.png';

<div className={styles.emptyPng}>
            <img src={EmptyPng} width={'100%'} />
          </div>

image

someone can help me solve this issue ? Thanks in advance

Can you create reproducible test repo, I think you have a mistake somewhere in a configuration

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!