compression-webpack-plugin icon indicating copy to clipboard operation
compression-webpack-plugin copied to clipboard

compress images not work

Open linxiaowu66 opened this issue 3 years ago • 1 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

linxiaowu66 avatar Aug 04 '22 05:08 linxiaowu66

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

alexander-akait avatar Aug 10 '22 13:08 alexander-akait

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

alexander-akait avatar Sep 19 '22 15:09 alexander-akait