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
Jan Piotrowski (janpio)
It's CLI commands all the way down then - vercel build runs next build under the hood afaik.
James
JamesOP12mo ago
Yup
Jan Piotrowski (janpio)
Ok, yes this works as expected 👍
James
JamesOP12mo ago
We also have a --skip-build flag to avoid running vercel build too in case you need that for debugging stuff
Jan Piotrowski (janpio)
It 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.
James
JamesOP12mo ago
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
Jan Piotrowski (janpio)
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 ...
James
JamesOP12mo ago
akoalathumbsup probably worth clarify in the docs, good call. i'll leave that one for dario to take care of when he's not busy 😅
Jan Piotrowski (janpio)
Smart 😄 I'll create a few more of those with things I run into, and then share in the channel as well.
James
JamesOP12mo ago
Much appreciated, always great to hear a fresh perspective on areas that can be improved
Want results from more Discord servers?
Add your server