Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next/image decreases (lighthouse) performance #60004

Open
1 task done
borisyordanov opened this issue Dec 28, 2023 · 5 comments
Open
1 task done

next/image decreases (lighthouse) performance #60004

borisyordanov opened this issue Dec 28, 2023 · 5 comments
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.

Comments

@borisyordanov
Copy link

borisyordanov commented Dec 28, 2023

Link to the code that reproduces this issue

See below

To Reproduce

I created a couple of code sandboxes with the nextjs starter example. The first is unmodified, the second one replaces the next/image package with an img HTML element.

  1. Generate a lighthouse report for the version with next/image
  2. Generate a lighthouse report for the version with img

I'm attaching the HTML reports that I got
reports.zip

Current vs. Expected behavior

Using the native image tag is apparently more performant. However the docs and the eslint rule @next/next/no-img-element discourage this option.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

https://codesandbox.io/docs/learn/environment/vm

Which area(s) are affected? (Select all that apply)

Image optimization (next/image, next/legacy/image)

Additional context

I first found these results in my production app, deployed on AWS Amplify. I reproduced the same result if I build the app and serve it locally. The issue is reproducible in the code sandbox as well, running the latest version of Next. It's unclear if this is an issue with Lighthouse or Next.
I tested with .svg and .png images. The priority prop doesn't seem to make a measurable difference.

@borisyordanov borisyordanov added the bug Issue was opened via the bug report template. label Dec 28, 2023
@github-actions github-actions bot added the Image (next/image) Related to Next.js Image Optimization. label Dec 28, 2023
@gabo2192
Copy link

gabo2192 commented Jan 5, 2024

I'm experiencing the same issue.

@thisislvca
Copy link

Same issue here. Using the default img tag improves page speed noticeably...

@naseef0
Copy link

naseef0 commented Apr 16, 2024

I also experiencing the same issue. I'm getting low LCP even with next images

@zS1m
Copy link

zS1m commented May 16, 2024

Same issue here

It is said in Next.js docs

You should use the priority property on any image detected as the Largest Contentful Paint (LCP) element. It may be appropriate to have multiple priority images, as different images may be the LCP element for different viewport sizes.

But the fact is, when I set priority to true, the LCP score decreases.

@Heet-Bhalodiya
Copy link

I'm also experiencing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.
Projects
None yet
Development

No branches or pull requests

6 participants