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

[canary] Img component bloats page JS files by inlining alternative images in the srcset #175

Open
tilman opened this issue Jul 24, 2020 · 2 comments

Comments

@tilman
Copy link

tilman commented Jul 24, 2020

I noticed that my Page get's very large if using the new Img Component. If using only a few Img Elements with each a few combinations of density, webp and sizes, the component will inline all alternative images from the srcset which are under 8Kb, even if they may never be used because of the wrong screen size or density. Hence that, I would suggest to turn off inlining of the images for the srcset by default or to add a new option which controls if the srcset alternatives should be inlined or not.

In my case I decreased my index page from 250kb to 80kb and increased the page speed from 60 to 95 just by lowering the inline limit to 1kb so that no alternatives are getting inlined.

@cyrilwanner
Copy link
Owner

Thank you for the report 👍 Yes, I think it makes sense to disable automatic inlining if there are more than 1 images in the srcset. I'll do that in the next canary version.

@cyrilwanner
Copy link
Owner

3.0.0-canary.4 should now work as you suggested it. Can you try it again and confirm that it now works as you would expect it to work? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants