Загрузка видео...

Не удалось загрузить видео

На главную

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

71,291 просмотров • 1 год назад •via X (Twitter)

Комментарии: 10

Фото профиля Alex Sidorenko
Alex Sidorenko1 год назад

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
Jarred Sumner1 год назад

@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
Potato Dragon1 год назад

so its better to import images for local images?

Фото профиля Anze Koprivec
Anze Koprivec1 год назад

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

Фото профиля Mamad
Mamad1 год назад

very useful

Фото профиля Coding With Mr.M
Coding With Mr.M1 год назад

For me i always import the images it’s best

Фото профиля González J.
González J.1 год назад

lovely, good to know

Фото профиля Thom Knepper 汤姆
Thom Knepper 汤姆1 год назад

BRB updating some projects

Фото профиля fhf
fhf1 год назад

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

Фото профиля Lost Cause 🐗
Lost Cause 🐗1 год назад

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

Похожие видео