NextJS:getStaticPropsrevalidatenotworking
I have this NextJS site where there is this getStaticProps that load data from Firestore.
I have this:
return {
props: {
allPosts: posts,
},
revalidate: 60,
}
where from what I know will load data from firebase every one minute. However, it doesn't seem to work and data are just not updated.
Is this revalidate an experimental feature? Anyway that I can get it to work? Else I would have to rebuild and export frequently.
回答
如果你想要增量静态再生(revalidate标志为getStaticProps),那么你需要运行 NextJs 服务器(next start命令),没有服务器就没有任何东西可以执行请求并生成新的静态文件。
next export 仅使用构建时可用的数据生成一次静态文件。
- This morning I changed the hosting provider to Vercel and it works right out of the bag. I will just stick to Vercel instead of Firebase hosting for now.
THE END
二维码