본문 바로가기
문서 정리 프레임워크/Nextra

[Nextra] .gif 파일 unoptimized warning 해결

by minhyeok.lee 2024. 8. 14.
반응형

Nextra .gif 파일 사용 시 "unoptimized" warning 해결


 

Nextra에서 .gif파일을 ![]() 형식으로 사용하면 아래와 같은 warning이 발생한다.

The requested resource "/_next/static/media/파일이름.gif" is an animated image so it will not be optimized.
Consider adding the "unoptimized" property to the <Image>.



해결방법

1. 변경 전

![.gif 파일없을 때 나오는 텍스트](/파일이름.gif)

2. 변경 후

<Image
  src="/파일이름.gif"
  alt=".gif 파일없을 때 나오는 텍스트"
  unoptimized={true}
  width={445}
  height={445}
/>

 

 

1. 위와 같이 <Image> 형식으로 변경해주면 index를 사용하지 않고 페이지를 구성할 수 있다.

2. width와 height를 지정해줘야 하는 단점이 있다.

반응형

댓글