image

Next.js - LargePageDataBytes

태그
Next.js
상세설명largePageDataBytes
작성일자2024.03.17

Notion api 로 불러오면서 하위 이미지와 같은 경고 문이 뜬다.

Warning: data for page "/" is 184 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
See more info here: https://nextjs.org/docs/messages/large-page-data

Large Page Data

공식 문서(https://nextjs.org/docs/messages/large-page-data) 에서는 데이터 양을 줄이라는 해결책을 줬지만 내 경우에 해당하는 해결 방법이 아니어서 다른 방법을 찾아보았다.

next.config.js

나랑 똑같은 문제를 겪고 있는 글을 찾아보니 next.config.js 에서 largePageDataBytes 의 값을 늘리는 방법이 있다.

const nextConfig = {
  ...
  experimental: {
  //largePageDataBytes: 128 * 1000, // 128KB by default
    largePageDataBytes: 128 * 100000,
  },
  ...
}

하지만 해당 설정을 할 경우 아래 경고 문이 나온다.

largePageDataBytes는 실험적인 기능으로 예상치 못한 또는 오동작을 일으킬 수 있다는 것을 알려주는 경고문으로 해당 기능 사용을 보류했다.

- warn You have enabled experimental feature (largePageDataBytes) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

참고

https://stackoverflow.com/questions/74116239/warning-data-for-page-blog-is-569-kb-which-exceeds-the-threshold-of-12

https://han-py.tistory.com/503