How do I change/update homepage
automatically without changing package.json
in a React app?
I have A and B project, both projects have individual roots for Production Build, but they share a same root for Test Build. That's why I have different homepage
configured for different environments. When I merge its Test Branch to its Prod Branch, I have to keep the package.json
file different, which is not smart at all.
So, are there any ways that I can grab an Env variable and pass in?
if you are using create-react-app
version greater or equal than 0.9.0 in package.json
remove homepage
and add PUBLIC_URL
in your .env file
Adding Custom Environment Variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With