Production builds require all dependencies for Next.js 15.2.4
Encountered an issue with the Vercel CLI 41.4.1 build process. Only affecting production builds, works fine for all pre-production/preview branches (i.e. development and test build and deploy previews just fine). What resolved it was either tagging the build command to install all dev dependencies or manually moving all dev dependencies to the required dependencies. See attached screenshots.
Production build:
Test build after merging prod back into test
Moving every package one at a time to dependencies to see which one it was:
Things I've tried (before finding the dependency solution) was forcing no build cache with env variables, nuking node_modules, lock file, and did a npm cache clean --force, install. Package upgrades and down grades.
This issue is a big deal since all work done in V0 can't be deploy in production.
Spent a lot of hours trying to solve it with V0 chat bot, but it doesn't get it, it end up changing the whole project code and going mental without solving the real problem.