Do I have to rebuild my Next.js app after changing environment variables?
Unanswered
Joel Cipriano posted this in #help-forum
I'm trying a new provider on my app and I'm having touble making it work. As part of the tests that I'm performing, I have to change the values of some environment variables a few times. Just chaning them and hitting reload on the browser a few seconds after is enough or after every single change of environment variables I have to rebuild my app?
8 Replies
Eulophid wasp
I would always restart when changing env variables 👌
On Vercel you can rerun a deployment but maintain the build cache - this will rebuild but with new config etc.
On Vercel you can rerun a deployment but maintain the build cache - this will rebuild but with new config etc.
How can I restart?
By "restart" you mean rebuild?
Eulophid wasp
Locally? yes, I just stop and restart
Wait - you only need to 'build' for deployment not for development.
Ok. Thanks!
Eulophid wasp
Your package file will likely have a dev script, so you can likely use
npm dev or yarn dev ... 🙂