Duolith docs

Errors E0500 to E0599

E0581 Route with parameters has no paths()

Message route loads at build but has no file

Words in italics are filled in when the compiler reports it, such as the element's name or the list of known ones.

Why

A page with parameters, such as pages/post/[id].duo, is written once per address at build, so the build needs to know which addresses there are. They come from a paths() function exported from the file beside the page, pages/post/[id].paths.ts, which runs in the same locked-down process as the loaders.

How to fix it

Write the paths file beside the page: export async function paths() { return [{ id: "1" }, { id: "2" }]; }. Or load when the screen opens instead of at build.

In a terminal

duolith explain E0581

Mentioned in