Skip to content

perf(blog): 이미지 priority 남용 제거 + AVIF 활성화 + GIF를 video로 교체 (#97)#131

Merged
Malloc72P merged 2 commits into
mainfrom
claude/issue-97-image-optimization
Jul 10, 2026
Merged

perf(blog): 이미지 priority 남용 제거 + AVIF 활성화 + GIF를 video로 교체 (#97)#131
Malloc72P merged 2 commits into
mainfrom
claude/issue-97-image-optimization

Conversation

@Malloc72P

Copy link
Copy Markdown
Owner

배경

  • next.config.mjsimages 설정이 없어 AVIF 포맷 협상이 비활성 상태였다.
  • PostImage가 모든 본문 이미지에 무조건 priority를 걸어 하단 이미지까지 즉시 preload되고, 대역폭 경쟁으로 첫 화면 LCP가 늦어질 수 있었다.
  • 애니메이션 GIF 3종(최대 256KB)이 next/image 파이프라인으로 비효율적으로 처리되고 있었다.

구현

  • AVIF 활성화: images.formats: ['image/avif', 'image/webp'] 추가. AVIF 우선 협상, 미지원 브라우저는 WebP 폴백.
  • priority 기본 해제: PostImage의 무조건 priority를 제거해 기본 lazy 로딩으로 전환. MDX 본문 이미지는 위치 정보가 없으므로, 첫 화면 이미지에만 쓸 수 있는 옵트인 priority?: boolean prop을 추가. 실제 표시폭 기준 sizes 속성도 부여해 과대 다운로드를 방지.
  • GIF → video 교체: ffmpeg(-movflags faststart, yuv420p)로 GIF 3종을 mp4로 변환해 교체.
    • create-chart: 219KB → 87KB / update-chart: 256KB → 62KB / sse-exam: 33KB → 19KB (합계 약 508KB → 168KB, 67% 감소)
    • GIF와 동일한 경험(autoPlay/loop/muted/playsInline)을 주는 PostVideo 컴포넌트를 신설하고, ai/ai-tool·ai/sse-exam 포스트의 참조를 교체(캡션/alt 의미 유지). 원본 GIF는 미참조 상태가 되어 삭제.

범위 밖

  • WebM 추가 인코딩(mp4 단일 포맷으로 충분히 목표 달성, 필요 시 후속)
  • 본문 첫 이미지 자동 priority 부여(MDX img 매핑에는 위치 정보가 없어 자동 판별 불가 → 옵트인 방식으로 대체)

검증

  • pnpm run build 성공 (Turbo, blog 앱 정적 생성 포함)
  • pnpm run lint 통과 (--max-warnings 0)
  • apps/blog pnpm test 통과 (24 suites / 98 tests, PostImage lazy 기본값·PostVideo 렌더 테스트 신규 추가)

Closes #97

- next/image에 AVIF/WebP 포맷 협상 추가, 본문 이미지 기본 lazy 전환(priority는 옵트인) 및 sizes 부여
- 애니메이션 GIF 3종을 ffmpeg로 mp4 변환 후 PostVideo(autoPlay/loop/muted) 컴포넌트로 교체
- PostImage lazy 기본값과 PostVideo 렌더 동작에 대한 jest 테스트 추가
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
blog Ignored Ignored Preview Jul 10, 2026 12:43am

- autoPlay 속성 제거, IntersectionObserver로 뷰포트 진입 시 play() 호출 + preload=metadata로 초기 대역폭 경쟁 해소
- controls 추가로 자동재생 차단 환경의 재생 수단과 무한 반복 영상의 일시정지 수단(WCAG 2.2.2) 확보
- prefers-reduced-motion 설정 시 자동재생 생략, 관련 테스트 3건 보강
@Malloc72P Malloc72P merged commit 9789d29 into main Jul 10, 2026
3 checks passed
@Malloc72P Malloc72P deleted the claude/issue-97-image-optimization branch July 10, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Perf] 이미지 priority 남용 제거 + AVIF + GIF를 video로 교체

1 participant