{"repo":"dotenvx/react-native-dotenv","free":true,"listed":false,"github":"https://github.com/dotenvx/react-native-dotenv","clone":"git clone https://github.com/dotenvx/react-native-dotenv.git","description":"Load .env into React Native - with support for multiple .env files.","language":"JavaScript","stars":858,"topics":["react","react-native","dotenv","react-native-config","environment-variables","12factor","babel","babel-plugin","config","configuration"],"license":"MIT","category":"mobile-apps","readme_excerpt":"react-native-dotenv Load .env into React Native with import statements. A Babel plugin that inlines your environment variables at build time — with multi-environment support. &nbsp; Usage Install it. Add it to your Babel config: Create a .env file in the root of your project: Import your environment variables: That's it. Your environment variables from .env are available via @env ! &nbsp; Advanced with Expo 🧭 Then start with a clean Metro cache: npx expo start --clear . envName (default: 'APP ENV' ) Override which environment variable selects the mode file (separate from NODE ENV ). Metro can overwrite the test environment even if you specify a config, so this gives you a dedicated override. The above example would use the .env.staging file. To use your own name: Note: if you're using APP ENV (or envName ), you cannot use development nor production as values, and you should avoid having a .env.development or .env.production . This is a Babel and Node thing that I have little control over unfortunately and is consistent with many other platforms that have an override option, like Gatsby. If you want to use development and production , you should not use APP ENV (or envName ), but rather the built-in NODE ENV=development or NODE ENV=production or you can just use debug vs release modes. It actually does compile but only for the start command so it is up to you but then you have to run react-native start every time you change the values. moduleName (default: '@env' ) The module","default_branch":null,"files":null,"tree":[],"storefront":"/r/dotenvx","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dotenvx/react-native-dotenv/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}