Investigate react-env for runtime .env switch
eric-burel opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
Next.js will bake NEXT_PUBLIC_* client variables at build time. So you cannot change those variables at runtime.
react-env brings the possibility of loading the variables at runtime instead. It's great for easy switch between different environment during development, or changing the route of an API. You just nee to restart the server, instead of building it.
This way, the client app behaviour is closer to the server behaviour regarding env variable: you simply need to restart to apply the change, instead of rebuilding. This is in particular less confusing for devops, that have the habit of just restarting the app to apply changes.
Describe alternatives you've considered
Node-config does something similar with JSON files => it would be closer to what exists in Meteor
React-env is closer to what exists in Next.js (env based configuration)