I use create-react-app and trying to set HOST=custom.local
variable with .env
file.
But it is always ignored with the message:
Attempting to bind to HOST environment variable: custom.localhost
If this was unintentional, check that you haven't mistakenly set it in your shell.
Also, I see this:
echo $HOST
M1-Air // <- my laptop name
So, how I understand this variable is already set and dotenv
within CRA won't overwrite it and just ignores, but any suggestions on what I need to do to set my custom HOST variable for CRA anyway?
I've found a similar issue on GitHub but it doesn't have any suggestions on how to resolve it: https://github.com/facebook/create-react-app/issues/4307
Looks like my issue isn't caused by reassigning the variable, but because my custom hostname custom.localhost
isn't mapped to any IP, even there is no such message.
Solved it by adding 0.0.0.0 custom.localhost
in my /etc/hosts
in addition to adding the domain to the .env
file.
I've found the answer here: https://stackoverflow.com/a/52595624/344306