云中
云中漫步楼主
next/font 加载失败,检查:① 字体文件路径是否正确 ② 是否在 root layout 中导入 ③ 变量字体用 variable 选项 ④ 避免在多个 layout 中重复加载同一字体 ⑤ 构建时下载字体需要网络。
next-intl 配置后 404,一般是 middleware 匹配规则不对。检查 middleware.ts 中 matcher 配置,确保排除了 /api、/_next、/admin 等非国际化路径。另外检查 defaultLocale 和 locales 配置是否正确。
Next.js Server Action 返回 undefined,可能是 Action 函数没有 return 值,或 return 的对象结构不对。Server Action 应该返回 { success: boolean, data?: T, error?: string } 格式。
revalidateTag vs revalidatePath:revalidateTag 清除特定 tag 的缓存(fetch 时用 next.tags 标记),revalidatePath 清除特定路径的缓存。数据变更后 revalidatePath 更直接,精细控制用 revalidateTag。
Prisma Json 字段查询,用 prismaToJson 过滤或 $queryRaw 用 PostgreSQL 的 ->> 操作符。Prisma 6 支持直接在 where 中用 path 过滤 Json 字段。