我这个配置错了吗?我的期望image-minimizer-webpack-plugin
是作为一个步骤,编译整个项目模块不正确吗?
此配置会导致所有测试的图像资产文件出现以下错误。图像文件仍然被压缩和发射;但是我不希望出现错误。
ERROR in Conflict: Multiple assets emit different content to the same filename ./imgs/[...]
new ImageMinimizerPlugin({
test: /\.(png|jpe?g)$/i,
deleteOriginalAssets: true,
minimizerOptions: {
plugins: [
['mozjpeg', { quality: 75 }],
['pngquant', { speed: 10, quality: [0.3, 0.5] }],
],
},
}),
{
test: /\.(png|jpe?g)$/i,
type: 'asset/resource',
generator: {
filename: './imgs/[base]'
},
},
new ImageMinimizerPlugin({
minimizerOptions: {
// Lossless optimization with custom option
// Feel free to experiment with options for better result for you
plugins: [
['gifsicle', { interlaced: true }],
['jpegtran', { progressive: true }],
['optipng', { optimizationLevel: 5 }],
[
'svgo',
{
plugins: [
{
removeViewBox: false,
},
],
},
],
],
},
}),
上述这种无损配置不会导致此类错误。