image-webpack-loader
image-webpack-loader copied to clipboard
webpack2.3.3版本 使用image-webpack-loader压缩图片无效,或者就是压缩后图片格式错误。
webpack2.3.3版本 使用image-webpack-loader压缩图片无效,或者就是压缩后图片格式错误。我的配置如下,webpack版本是2.3.3
//图片压缩
{
test: /.(gif|png|jpe?g|svg)$/i,
// loader: [url-loader?limit=10000&name=${ASSETS_DIR}/images/[name].[hash:8].[ext]
],
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
name: ${ASSETS_DIR}/images/[name].[hash:8].[ext]
}
},
{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: true, // [email protected]
disable: true, // [email protected] and newer
mozjpeg: {
progressive: true,
quality: 65
},
// optipng.enabled: false will disable optipng
optipng: {
enabled: false,
},
pngquant: {
quality: '65-90',
speed: 4
},
gifsicle: {
interlaced: false,
},
// the webp option will enable WEBP
webp: {
quality: 75
}
},
}
]
},
官方明明说加这句 disable: true, // [email protected] and newer ,webpack2.x版本以上的,我加了这句话,压缩没效果,图片大小一样, 如果把这句话去掉了,压缩出来的图片格式就是错误的了, 有没有大神知道我的问题是什么原因?求解。
把最后边的webp删掉
Could you translate ? also use webpack v4+