How to access files on production (Vercel deployment)

Hi! I'm have some mdx files which are directly red with readdirSync, so i have configured it to detect if it is in dev or prod environment. The mdx files are in /public/docs/*.mdx So when accessing in local enviroment i use path.join("public", "docs"), and when im in prod i use: path.join(process.cwd(), "docs"), which in vercel logs it says that it is trying to access /var/tasks/docs. And it is not finding the folder, however, when I look at the output info of my vercel deployment, the docs folder is there at the root with all the .mdx files, how do i access them in production?
1 Reply
NeoFox
NeoFox12mo ago
Since they are in the public folder you can get them on the root url: /docs/*mdx
Want results from more Discord servers?
Add your server