[英]How can i access evironment variables in present NodeJS from ReactJS
I want to use my .env
variable presend in my nodejs root folder in reactjs. I tried using process.env.TEST
but i always get undefined.我想在 reactjs 的 nodejs 根文件夹中使用我的
.env
变量。我尝试使用process.env.TEST
,但我总是未定义。 any solutions?任何解决方案?
My folder structure.我的文件夹结构。
Project root
|-client
| |- //react project files
| |-app.js
|
|- //nodejs project files
|-.env
|-server.js
I want to access my.env variables in app.js and its components我想访问 app.js 及其组件中的 my.env 变量
You can use find-up to get your variables in your whole monorepo.您可以使用find-up来获取整个 monorepo 中的变量。
Find here a bright article on the usage.在这里找到一篇关于用法的精彩文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.