I want to generate webp files from jpg/png from webpack. To do that i using image-webpack-plugin (https://github.com/tcoopman/image-webpack-loader)
In the plugin documentation it's written that the webp additional optimizer "Compress JPG & PNG images into WEBP" (https://github.com/tcoopman/image-webpack-loader#usage) but after followed the documentation steps the conversion not work.
The files are exported in jpg but nothing is converted.
I've already followed these posts but i've don't understand how to translate in a "non-react" environment :
Webpack imagemin plugin to compress jpg, png and create webp?
Webpack (Encore): convert images to webp using image-webpack-loader
webpack.config.js
{
test:/\.(gif|png|jpe?g|svg)$/i,
use:[
{
loader:'file-loader',
options:{
outputPath:'images',
name:'[name].[ext]'
}
},
{
loader:'image-webpack-loader',
options:{
mozjpeg:{
progressive:true,
quality:65
},
optipng:{ enabled: false },
pngquant:{ quality: [ 0.65, 0.90 ], speed:4 },
gifsicle:{ interlaced: false },
webp:{ quality: 75 }
}
}
]
}
Is there a reliable and clean way to turn jpg / png files into webp via webpack ?