Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Lighthouse error loading webp images

I am trying to improve my performance score on google lighthouse. It was recommending using next-gen image formats, including webp, so I implemented serving webp in place of images where the request accept header includes webp by using Nginx config something like this...

map $http_accept $webp_suffix {
  default   "";
  "~*webp"  ".webp";
}

server {
  root /www/;
  listen 80 default_server;
  index index.html;

  location ~* ^\/images\/ {
    expires max;
    add_header Vary Accept;
    try_files $uri$webp_suffix $uri =404;
  }

  location / {
    try_files $uri $uri/index.html =404;
  }

  error_page 404 /404.html;
}

Now the page loads much faster, and the webp method is working well, with fallback to original image where no webp exists or browser does not support it. However, the lighthouse report is showing an error, so I can't be sure I have implemented everything right. What does this error mean?

lighthouse opportunities

like image 362
Billy Moon Avatar asked Jul 05 '19 12:07

Billy Moon


People also ask

How can I improve page load performance with lighthouse?

You can run it from within Chrome DevTools, as a Chrome Extension, or even as a Node module, which is useful for continuous integration. For a while now, Lighthouse has provided many tips for improving page load performance, such as enabling text compression or reducing render-blocking scripts.

How do I update the lighthouse Chrome extension?

The Lighthouse Chrome extension should automatically update, but you can manually update it via chrome://extensions. In DevTools, you can run Lighthouse in the audits panel. Chrome updates to a new version about every 6 weeks, so some newer audits may not be available.

How to fix Google Chrome Can’t load images?

Here is how to do it: Open Chrome and go to chrome://settings/content/javascript. Make sure the toggle next to Allowed (recommended) is turned on. Visit the website again to see if the images can be loaded normally. If not, try the next fix to turn off hardware acceleration.

Why are my images not loading on my website?

Go to Network > Img and check the Status column. If the status code is 4xx or 5xx (e.g. 404, 403, 504, etc.), it suggests that the images not loading issues is more likely to be the website servers problem. If the there is no 4xx or 5xx status code on the status column, try Fix 2, below.


1 Answers

Update your lighthouse to version 2.4 onwards

On prior versions the webp extension was not handled correctly

https://github.com/GoogleChrome/lighthouse/issues/3364

If that's not working probably You might need to file an issue on Github

like image 151
mario ruiz Avatar answered Nov 15 '22 13:11

mario ruiz