Dotenv Env #297
-
How can I set up dotenv to be used in env.js? I've repeatedly created new projects but when I set up dotenv, I always encounter errors like fs, os, or others. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
dotenv
can't be used in React Native during runtime and should only be used at build time. This is precisely what we are doing with the project structure. If you check carefully, we are importing theenv.js
only inapp.config.ts
, as this will be used by Expo while generating the project (build time). To use those environment variables in thesrc
project(runtime), we pass all those environment variables as extras inapp.config.ts
and then export them insrc/core/env.js
. make sure to read the guide for more details