Next.js Discord

Discord Forum

Difference between production (Vercel) build and local build

Unanswered
Banjara Hound posted this in #help-forum
Open in Discord
Banjara HoundOP
When I build my project locally (npx next build) and serve it (npx next start) my menu items and one or two other things work perfectly. However, when I push to my main repo and Vercel builds and deploys, those things don't work at all.

I have MDX files as the contents for the pages.

Overall question is, what could I check that might be causing this? Everything works fine when running dev or even build locally, but production through Vercel doesn't.

Thanks

1 Reply

Banjara HoundOP
So I've managed to narrow it down to this code:
let pages = await glob('**/*.mdx', { cwd: process.cwd() + '/src/app' })
  console.log('pages = ' + pages)


When run locally, it finds a bunch of .mdx files and processes them as expected. When built locally, it works fine too.
However when I push, and it's compiled in Vercel, it finds no pages at all.

Any thoughts?