Oh sorry yes, if you want to use pages:
Oh sorry yes, if you want to use pages:dev, you would need to run pages:build first. It builds the Next.js app via vercel's cli actually, instead of just next build, and then takes the output and transforms it, but yes, it does a normal build under the hood
10 Replies
It's CLI commands all the way down then -
vercel build
runs next build
under the hood afaik.Yup
Ok, yes this works as expected 👍
We also have a
--skip-build
flag to avoid running vercel build
too in case you need that for debugging stuffIt was a bit surprising that
pages:dev
requires a pages:build
first, while pages:deploy
just takes care of the build via the npm script. I think that made me stumble a bit here.Yeah the deploy command runs both the build command and wrangler pages deploy, whereas the dev command only runs wrangler pages dev as you might not want to rebuild just so you can run wrangler dev
I turned this into a "documentation request" issue: https://github.com/cloudflare/next-on-pages/issues/603
GitHub
Documentation: Mention expected workflow for local builds and dev m...
https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/, the main documentation for this approach, does not mention how to locally use build, dev, pages:build, and pages:dev ...
probably worth clarify in the docs, good call. i'll leave that one for dario to take care of when he's not busy 😅
Smart 😄
I'll create a few more of those with things I run into, and then share in the channel as well.
Much appreciated, always great to hear a fresh perspective on areas that can be improved