Next.js Discord

Discord Forum

Imported files from a prebuild script is not showing in Vercel deployment in the source

Unanswered
Ocicat posted this in #help-forum
Open in Discord
OcicatOP
I have a Next.js app (v14) using the app directory. I'm using a node script to fetch all mdx files from another repository with the command pnpm fetch-docs.

This command is putting all content into /content/docs at the root of my project so I end up having:

/app
/components
/content -- /docs
lib ...

All the mdx files imported are not saved in the repo. I would like to fetch then at build time just before the next build. Locally I do first pnpm fetch-docs to fetch the data and then I launch pnpm dev. This is working really well.

The problem is when I am publishing my site to Vercel. I modified the build command to have pnpm fetch-docs && next build and I can see in the build process that it is fetching the data but if I see the source, I don't see the imported files and my app is missing those files.

Locally, if I do next start everything does work as expected.

Any idea where I might do something wrong?

0 Replies