react-native-dotenv in react native expo working for ios and android but NOT web #407
Replies: 1 comment 9 replies
-
Although this is heavily tested on Android and iOS, I do most of my tests with web. Sorry it's not working for you! Let's figure out why that's the case.
|
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using react-native, "expo": "^46.0.14" in macOS Monterey 12.6.3,
I installed "react-native-dotenv" in my react native expo app and it's working fine for ios and android but it's NOT working in my Web Development Build.
Web does not see path:
import { EXPO_CLIENT_ID, ANDROID_CLIENT_ID, IOS_CLIENT_ID, WEB_CLIENT_ID } from "@env";
and reads,
console.log(process.env.EXPO_CLIENT_ID);
asundefined
.I installed
yarn add react-native-dotenv
Created and put the following 2 files, in the root of my directory, see below:
// .babelrc
// .env
on https://www.npmjs.com/package/react-native-dotenv the claim is made:
Introduction
This babel plugin lets you inject your environment variables into your Javascript environment using dotenv for multiple environments. It is best suited for use with react native and works with all flavors including web.
Any thoughts, comments, or suggestions would be greatly appreciated!
Derek
Beta Was this translation helpful? Give feedback.
All reactions