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

ERROR in outputName is not defined #85

Open Korveld opened 2 years ago

Korveld commented 2 years ago

Please help!

Can't convert images to webp, error messages appears "ERROR in outputName is not defined" "ERROR in ImageminWebpWebpackPlugin: "images/hero/hero.png" wasn't converted!"

here's my webpack.mix.js

`let mix = require('laravel-mix');

const ImageminPlugin = require('imagemin-webpack-plugin').default; const CopyWebpackPlugin = require('copy-webpack-plugin'); const imageminMozjpeg = require('imagemin-mozjpeg'); const ImageminWebpWebpackPlugin = require("imagemin-webp-webpack-plugin");

mix.setPublicPath('public_html/');

// Images mix.webpackConfig({ plugins: [ //Compress images new CopyWebpackPlugin([{ from: '*/', // FROM to: 'images/', // TO context: "resources/assets/images/", }]), new ImageminPlugin({ test: /.(jpe?g|png|gif|svg)$/i, pngquant: { quality: '70-80' }, plugins: [ imageminMozjpeg({ quality: 85, //Set the maximum memory to use in kbytes maxmemory: 1000 * 512 }) ] }), new ImageminWebpWebpackPlugin({ config: [{ test: /.(jpe?g|png)/, options: { quality: 75 } }], overrideExtension: true, detailedLogs: true, silent: false, strict: true }) ], });`