News for hackers. Stuff that matters.
Re:Next.js 14 by cyral on Thursday October 26, 2023 @03:21PM (#38030493)
The image component works fine when self-hosting, I use it on several production sites. What is it that doesn't work well without their cloud service?

The default bundle size is also nowhere near 1MB. Next 13 and server components entire point is to reduce the bundle size by not shipping JS that is only ever called on the server.

Re:Next.js 14 by orf on Thursday October 26, 2023 @03:25PM (#38030557)
How do I optimise and convert all my static image files to webp with a PNG fallback, then render them as a srcset so the client can pick the best image?

I.e everything that’s done here[1]

Oh no. You can’t. You need to set “images.unoptimized = true” and be happy about it if you’re not using a cloud image service.

1. https://docs.astro.build/en/guides/images/#properties

Re:Next.js 14 by cyral on Thursday October 26, 2023 @03:32PM (#38030636)
I'm not sure why this is your experience, but the site I am referencing does exactly that. The images are even being pulled from an external domain. They are not PNGs but I am not sure if that makes a difference (they are 100 quality .webp), they get optimized to a lower quality and have srcset, no vercel involved because I do not want a dependency on Vercel.
Re:Next.js 14 by 5Qn8mNbc2FNCiVV on Thursday October 26, 2023 @05:12PM (#38031776)
You just use the image component and specify the sizes. The png fallback is provided via the server looking for the Accept header so when it supports webp it gives you webp, otherwise you get png (or jpg depending on the original extension)
Re:Next.js 14 by leerob on Thursday October 26, 2023 @03:24PM (#38030536)
next/image optimization works by default when self-hosting. You can optionally use basically any image service you want through a “loader file”.

https://nextjs.org/docs/app/api-reference/components/image#l...

Re:Next.js 14 by orf on Thursday October 26, 2023 @03:32PM (#38030641)
> Instead of optimizing images at build time, Next.js optimizes images on-demand as users request them.