When my Server gets setted up again (new next-build and pm2 restart
) on Deploy. The Initial Load of Images takes way to long, like 30 - 50 seconds, I guess thats because NextJS
does image optimization on-demand and not on build time to prevent huge build times when there are like several hundred images.
But it can't be that I have to visit my Sites on every device width after each deploy to get image optimization and better loading results for my users?
What are your advices to that? Do you scale down all your Images with 3rd Party tools and then again on-demand with next/image
?
or do you ignore next/image
directly? Or is there something i am missing right now?
I am using the fill
property with the sizes pattern (max-width: XX) XXvw, XXvw)
and my Application is running with next start
on my own hosted server, I do not use next export
to generate a static site.
Till now I tried several things with next/image
to shrink down my Image sizes.
using fill
and sizes
as mentioned, but the problem stays the same, on-demand image providing is in the worst case 50 seconds. And I guess thats because the User is requesting an certain image -> nextJS does optimize it -> returns it back to user. WHEN the first page load is executed, every other user benefits from it, because nextJS already have those compressed images.