iampava / imagemin-webp-webpack-plugin

Webpack plugin which converts images to the WebP format while also keeping the original files.
MIT License
113 stars 27 forks source link

Exclude options #67

Closed Nikolasgrizli closed 2 years ago

Nikolasgrizli commented 2 years ago

Hello, thanks for this wonderful plugin, I have tried many before, but because of my little experience with webpack, I didn’t get what I wanted or didn’t work at all ((( This great plugin worked the first time as it should, amazing! (although to be honest, I first tried to clone the repository and run it locally with webpack 5 and it didn’t work for me - first there was an error with the lack of rm (I have windows), then with the lack of imgmin-gif2webp )) I just have one question right now that I would like to clarify - is it possible to use a path here to exclude certain directories? I have a project structure like this: root -favicon -imgBuild -static --src ---imgsrc ---media ----favicon ----other when I started project images from imgsrc moving to imgBuild(throw file-loader) and images and other materials from directory media moving to root.

I tried like this: new ImageminWebpWebpackPlugin({ detailedLogs: true, overrideExtension: true, config: [{ test: /\.(jpe?g|png|gif)/, exclude: /favicon/, options: { quality: 75 } }], }), and changed to this: exclude: /media/, but it's not worked for me(