webpack-contrib/compression-webpack-plugin

ERROR in Conflict: Multiple assets emit different content to the same filename css/.gz

sushmitg opened this issue · 1 comments

I am upgrading to webpack 5 and as per the official doc, we need to upgrade all the plugins and loaders to their latest version.
So, I updated my compression-webpack-plugin to v10. But now while creating a production build I am getting following error:

image

Here's my configuration:

    new CompressionPlugin({
      filename: '[path].gz[query]',
      algorithm: 'gzip',
      test: /\.js$|\.css$|\.html$/,
      threshold: 10240,
      minRatio: 0.8,
    }),

Am I missing anything?

Hello, please read https://github.com/webpack-contrib/compression-webpack-plugin#string-1

[path] is replaced with the directories to the original asset, included trailing / (assets/images/).

You should add [base] is replaced with the base ([name] + [ext]) of the original asset (image.png)., i.e. filename: "[path][base].gz[query]",