Video wird geladen...
Video konnte nicht geladen werden
Importing local images vs referencing them from "/public" folder in Next.js
71,291 Aufrufe • vor 1 Jahr •via X (Twitter)
10 Kommentare

When using imports for local images: - Next automatically determines width and height, so no need to set it manually - Next hashes the file contents and sets high max-age for cache-control so images are cached in browser (faster load / lower serverless bill)

@leerob have you thought about making it so the image can be a component itself? It can implement toString which would preserve backwards compatibility both with <Image /> and for string usage

so its better to import images for local images?

Don’t most hosting providers just cache these at the CDN level anyway?

very useful

For me i always import the images it’s best

lovely, good to know

BRB updating some projects

Sum up, don't put images in the public dir

Lets add another variable as "output: standalone" and this post is rather misleading
