NextJS 13의 RSC 내에서 단순히 서버에서 데이터 페치를 위해
await fetch(url, {method: 'get'})
만 주면 프로젝트를 빌드할 때
Export encountered errors on following paths
에러를 만날 수 있다
아마도 SSG로 동작을 해서 그러는 것으로 보이는데, SSR로 만들기 위해 옵션을 이렇게 바꿔주면 에러가 없어지고 빌드도 잘 되고 페이지도 잘 보인다.
await fetch(url, {method: 'get', cache: 'no-store'})
이렇게 주는 것이 이전의 getServerProps와 유사한 동작이라고 한다
p.s.
그러나 axios에서 똑같이 cache no-store를 주는 것은 여전히 에러가 발생한다. 그 이유는 모르겠다...
await axios.get(url, { headers: { 'Cache-Control': 'no-store'}})
// 에러 발생...
@spacebuffer thanks! I figured out actually using Nextjs 13 with getStaticParams. The truth is that I was working hours in the wrong file like an idiot. Once I figured that out it was solved. getStaticProps was replaced and is actually more intuitive after unlearning the old way. #nextjs13 #nextjs
@spacebuffer hello. Question: are you using generateStaticParams in Nextjs 13 for your individual blog posts? I never did but it somehow was working. Unfortunately, my tags and categories are not working. So I am trying to using generateStaticParams but no luck.