[알게된 것] Next.JS priority 이미지 불러오기 관련 오류

Chobby·2024년 1월 25일
1

알게된 것

목록 보기
41/50

😀문제상황

메인 페이지의 이미지를 불러오는 과정에서 priority 설정이 필요하다는 로그에 의해 속성을 지정해두니 다음 에러가 뜸

The resource ... was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally.

😁해결방법

아마 Image 태그의 src 속성을 문자열로 ex)public/../../../image.jpg 설정해두었을건데 그러지 말고 import 하여 지정해야함

import Logo from "@/public/assets/images/logo/main.png";
...
 <Image
   src={Logo}
   width={250}
   height={200}
   className="h-auto"
   alt="Logo"
   priority
 />
profile
내 지식을 공유할 수 있는 대담함

0개의 댓글