Skip to content

预渲染的动态端点存在路径冲突。

PrerenderDynamicEndpointPathCollide:无法使用 undefined 参数渲染 PATHNAME,因为生成的路径将在预渲染期间发生冲突。防止将 undefined 作为 params 传递给端点的 getStaticPaths() 功能,或向端点的文件名添加额外的扩展名。

¥PrerenderDynamicEndpointPathCollide: Could not render PATHNAME with an undefined param as the generated path will collide during prerendering. Prevent passing undefined as params for the endpoint’s getStaticPaths() function, or add an additional extension to the endpoint’s filename.

¥What went wrong?

端点使用 undefined 参数进行预渲染,因此生成的路径将与另一条路由发生冲突。

¥The endpoint is prerendered with an undefined param so the generated path will collide with another route.

如果无法阻止传递 undefined,则可以在端点文件名中添加额外的扩展名,以生成具有不同名称的文件。例如,将 pages/api/[slug].ts 重命名为 pages/api/[slug].json.ts

¥If you cannot prevent passing undefined, then an additional extension can be added to the endpoint file name to generate the file with a different name. For example, renaming pages/api/[slug].ts to pages/api/[slug].json.ts.

也可以看看:

¥See Also:

Astro 中文网 - 粤ICP备13048890号