【发布时间】:2021-09-16 05:50:36
【问题描述】:
我使用 create-react-app 并尝试使用 .env 文件设置 HOST=custom.local 变量。
但它总是被消息忽略:
Attempting to bind to HOST environment variable: custom.localhost
If this was unintentional, check that you haven't mistakenly set it in your shell.
另外,我看到了这个:
echo $HOST
M1-Air // <- my laptop name
那么,我如何理解这个变量已经设置并且 CRA 中的 dotenv 不会覆盖它而只是忽略,但是关于我需要做什么来为 CRA 设置我的自定义 HOST 变量有什么建议吗?
我在 GitHub 上发现了一个类似的问题,但没有关于如何解决它的任何建议: https://github.com/facebook/create-react-app/issues/4307
【问题讨论】:
标签: environment-variables localhost create-react-app dotenv