next.js 增量静态生成在版本13中不起作用

pdkcd3nj  于 2023-08-04  发布在  其他
关注(0)|答案(1)|浏览(95)

ISR是否适用于NextJS 13 Beta版本中的任何人?
我用revalidate做了下面的事情。

export const revalidate = 15;

字符串
当我执行npm run build时,它仍然以SSG(静态站点生成)页面结束。
符号为空白色。
我错过了什么?我希望页面是ISR
P.S:也尝试了fetch API和{ next: { revalidate: 15 }},结果是一样的。
在terminal中,这是npm run build后的输出。
x1c 0d1x的数据
这不是动态路由。
位置是app/page.jsx,所以它在localhost:3000打开

import axios from "axios";
import Card from "@/components/Card";

export const revalidate = 15; // seems to have no effect

const AllCards = async () => {
  const url = 'http://localhost:3001/cards';
  const fetchCards = await axios.get(url);
  const cards = fetchCards.data.data;
  return (
    <main>
      <div className='text-3xl font-bold underline text-center mb-4 mt-4'>
        All Cards
      </div>
      <div className='flex flex-wrap justify-center gap-2'>
        {cards.map(c => <Card vanity={c.vanity} art={c.art} id={c.id} />)}
      </div>
    </main>
  );
}

export default AllCards;

z9ju0rcb

z9ju0rcb1#

我认为你需要给予它:
第一个月
即使没有参数,我也只是给予它一个空数组。-

相关问题