how to disable edge environment only locally(export const runtime = 'edge')
When I only want to run it in a non-edge environment locally, how should I configure the pages in Next.js?
In summary,
I would like to do it as follows locally
//export const runtime = 'edge'
When deploying to Cloudflare, I would like to do it as follows.
export const runtime = 'edge'
It seems that runtime settings cannot be configured dynamically.
const test = 'eidge'
export const runtime = test
Even with the above settings, I encountered an error when running npx @cloudflare/next-on-pages@1
Please let me know if there are any other solutions or improvements.
1 Reply
You shouldn't be toggling the edge runtime on for deployments and off for development. You should opt routes that need it into the edge runtime, and leave them with it. Trying to switch between having it and not having it when you do deployments is likely to lead to issues with compatibility as you have a false idea of what is compatible during local development