Webpack 在image minimizer网页包插件(mozjpeg,pngquant)中使用有损模块时出错
我的配置是否有误?我的期望是将Webpack 在image minimizer网页包插件(mozjpeg,pngquant)中使用有损模块时出错,webpack,imagemin,pngquant,lossy-compression,mozjpeg,Webpack,Imagemin,Pngquant,Lossy Compression,Mozjpeg,我的配置是否有误?我的期望是将图像最小化网页包插件作为一个单一步骤使用,编译整个项目模块,这是不正确的吗 此配置导致所有测试的映像资产文件出现以下错误。图像文件仍然被压缩和发射;然而,我不希望出现错误 冲突中的错误:多个资产向同一文件名发出不同的内容。/imgs/[…] new ImageMinimizerPlugin({ test: /\.(png|jpe?g)$/i, deleteOriginalAssets: true, minimizerOpt
图像最小化网页包插件
作为一个单一步骤使用,编译整个项目模块,这是不正确的吗
此配置导致所有测试的映像资产文件出现以下错误。图像文件仍然被压缩和发射;然而,我不希望出现错误
冲突中的错误:多个资产向同一文件名发出不同的内容。/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,
},
],
},
],
],
},
}),