Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 925 Bytes

invalid-get-static-paths-entry.mdx

File metadata and controls

25 lines (18 loc) · 925 Bytes
title i18nReady githubURL
Invalid entry inside getStaticPath's return value
true

InvalidGetStaticPathsEntry:由 getStaticPaths 所返回的无效项。期望是一个对象,但却是 ENTRY_TYPE

哪里发生了错误?

getStaticPaths 的返回值必须是一个对象数组。在大多数情况下,这个错误是由于返回了一个数组的数组造成的。可以使用 .flatMap().flat() 来解决此问题。

export async function getStaticPaths() {
	return [ // <-- 数组
		{ params: { slug: "blog" } }, // <-- 对象
		{ params: { slug: "about" } }
	];
}

参见