Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Enabling WebP doesn't seem to generate images #138

Open
adamgravita opened this issue Jan 25, 2018 · 6 comments
Open

Enabling WebP doesn't seem to generate images #138

adamgravita opened this issue Jan 25, 2018 · 6 comments

Comments

@adamgravita
Copy link

Hi all, thanks for an amazing loader. I've just started to use it and noticed that even when enabling WebP - my outputted images do not contain .webp files. They're just the PNG's....

Given the document description I thought this would generate my images and also my images compressed and outputted as webp.

And optional optimizers:

webp — Compress JPG & PNG images into WEBP

Here is a sample of my loader array

        {
            test: /\.jsx?$/,
            loaders: ['babel-loader'],
            include: path.join(__dirname, 'src')
        },
        {
            test: /\.(gif|png|jpe?g|svg)$/i,
            use: [
                    {
                        loader: 'url-loader',
                        options: {
                            limit: 100,
                            name: 'images/[name].[hash].[ext]'
                        }
                    },
                   
                    {
                        loader: 'image-webpack-loader',
                        options: {
                                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: 80,
                                    enabled: true
                                }
                            }
                    }

                
                ],
            },
@glemiere
Copy link

I think this loader doesn't work with url-loader yet.

@chjiyun
Copy link

chjiyun commented Apr 23, 2018

@glemiere I have a same problem with you, Have you worked out?

@glemiere
Copy link

glemiere commented Apr 23, 2018

Yeah I fixed it, I don't remember exactly how, you can still check my config on the related project
https://github.com/glemiere/nextjs-starter-pwa/blob/master/next.config.js
PS : Note that webp is currently only supported by chrome.

@infctr
Copy link

infctr commented Oct 1, 2018

That doesn't clarify much. webp images are not generated with both default config from readme and with all optimizers.enabled set to false 😕

@thmsnhl
Copy link

thmsnhl commented May 8, 2019

Has anyone successfully generated webp images yet? I just followed the documentation and still, the output directory does not contain a single .webp 🙁

@manafire
Copy link

I had a similar config, but with file-loader. The JPG|PNG files are actually being converted to webp - but preserving their original filename extension. They aren't renamed with (.webp) like I also expected.

In my case, I wanted to have optimized JPG files for older browsers AND their modern webp equivalents. I couldn't get this working with loaders so I dropped the webp option from image-webpack-loader altogether and added ImageminWebpWebpackPlugin to plugins to process it after.

https://github.com/iampava/imagemin-webp-webpack-plugin

kobezzza pushed a commit to V4Fire/Client that referenced this issue Jun 19, 2020
* Fix webp images generating

* Separate loader for webp images. tcoopman/image-webpack-loader#138

* Update CHANGELOG.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants