app/api/nav/route.ts
export async function GET(request: Request) {
const test = []
for (const name of await fs.readdir(
path.resolve(process.cwd(), 'app/blog/data_structure/tree')
)) {
test.push(name)
}
const result = {
code: 200,
test: test,
}
return NextResponse.json(result)
}
export async function POST(request: Request) {
return NextResponse.json({ data: true })
}
vercel 环境 没有注释掉 POST 的 nav 请求,少了个 page.tsx 数据
{
"code": 200,
"test": [
"readme.mdx"
]
}
vercel 环境 注释掉 POST 的 nav 请求,就正常了
{
"code": 200,
"test": [
"page.tsx",
"readme.mdx"
]
}
最小复现,https://github.com/linzhe141/minimal-nextjs-isssue