Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

Importing local images vs referencing them from "/public" folder in Next.js

71,291 görüntüleme • 1 yıl önce •via X (Twitter)

10 Yorum

Alex Sidorenko profil fotoğrafı
Alex Sidorenko1 yıl önce

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)

Jarred Sumner profil fotoğrafı
Jarred Sumner1 yıl önce

@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

Potato Dragon profil fotoğrafı
Potato Dragon1 yıl önce

so its better to import images for local images?

Anze Koprivec profil fotoğrafı
Anze Koprivec1 yıl önce

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

Mamad profil fotoğrafı
Mamad1 yıl önce

very useful

Coding With Mr.M profil fotoğrafı
Coding With Mr.M1 yıl önce

For me i always import the images it’s best

González J. profil fotoğrafı
González J.1 yıl önce

lovely, good to know

Thom Knepper 汤姆 profil fotoğrafı
Thom Knepper 汤姆1 yıl önce

BRB updating some projects

fhf profil fotoğrafı
fhf1 yıl önce

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

Lost Cause 🐗 profil fotoğrafı
Lost Cause 🐗1 yıl önce

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

Benzer Videolar