It doesn't work, the picture is not compressed
lixianbin1 opened this issue · comments
I follow the content of the documentation, but it does not work, I do not understand what went wrong.The file is packaged without error, but the picture is not compressed.
{
test: /\.(png|svg|jpg|jpeg|gif)$/,
use: [{
loader:'file-loader',
options:{
outputPath:"images/",
publicPath:"./images",
}
},{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: true, // webpack@1.x
disable: true, // webpack@2.x and newer
mozjpeg: {
progressive: true,
quality: 65
},
optipng: {
enabled: false,
},
pngquant: {
quality: [0.65, 0.90],
speed: 4
},
gifsicle: {
interlaced: false,
}
},
},]
},
There are also the following configuration
{
test: /\.(html)$/,
use: {
loader: 'html-loader',
options: {
attributes:{
list:[
{
tag:'img',
attribute:"src",
type:"src"
},{
tag:'img',
attribute:"data-src",
type:"src"
},
],
},
minimize:true
}
}
}
you have disable: true
, you should only set disable true for development
not for a production build
Is it set to disable: false
? , But I setdisable: false
, and then packaged, a new problem appeared: "Cannot find the module'pngquant-bin"; libpng-dev does not exist in Windows, what should I do?
I would take a look at the repository of pngquant-bin
and find out why it doesn’t work on windows. Maybe try to reinstall the package.
I’m closing the issue because the original problem is solved.