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.
dotenvcan'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.jsonly inapp.config.ts, as this will be used by Expo while generating the project (build time). To use those environment variables in thesrcproject(runtime), we pass all those environment variables as extras inapp.config.tsand then export them insrc/core/env.js. make sure to read the guide for more details