get-all-static-data
Workaround to 'return data' from Next.js's getStaticPaths
https://github.com/vercel/next.js/discussions/11272
There is no real magic here, it creates a .cache file
that getStaticProps
will read under build, and reuses the pathMapper
to return the correct data.
This is based on this comment https://github.com/vercel/next.js/issues/10933#issuecomment-598297975
Usage
Available parameters:
Example
getAllStaticData
takes two required params, getData
and pathMapper
, and returns two functions
import getAllStaticData from "get-all-static-data" const pageData = const getStaticPaths = pageDataconst getStaticProps = pageData { return <pre>JSON</pre>}