-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible with expo-router #501
Comments
Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/501 |
To provide some more context, Expo uses internal environment variables that are not considered public (and therefore should never end up in the bundle). If these variables can be left untouched, we should have a way to get Expo Router and react-native-dotenv to work together. Basically, all |
|
This babel plugin is meant to be simple and non specific. React native dotenv is meant to encourage best practices |
My bad I didn't see you provided a repro project. I'm taking a look now |
I also didn't read that blocklist didn't work for you. That is concerning. |
Yeah, I'm not exactly sure what's going on. In Expo, we do some bundling and possible static rendering (basically evaluating parts of bundle code in Node). Not sure if that might have anything to do with it. So far, neither It would be nice if this library can work in Expo, if users need more control over it. |
- Comment out for goatandsheep/react-native-dotenv#501
I'm having the same problem and since my project is still under development I've unshifted |
I was facing the same problem. FYI, the incompatibility of As an alternative for |
@mayel15 unfortunately expo's built in env variables is not ideal, rn dotenv is way better. |
@a-eid - can you explain the limitations that you're encountering? you could try disabling them, i'm not sure if that will help here though: https://docs.expo.dev/guides/environment-variables/#disabling-environment-variables |
@brentvatne in expo we don't have the ability to load arbitrary .env files. for example however with RN dotenv, we're able to do so use the |
+1 Fortunately, I was able not to depend on react-native-dotenv. |
+1 here, our app is dependent on this package for reasons outlined by @a-eid. Is there something in the works for a fix? |
@brentvatne Hey forgot about this issue since I just forked it and made it work on my own. Not well versed in public repo contributions here, so don't know the process. If this code helps anyone, feel free to use, I only changed the index.js. https://github.com/cchoi94/react-native-dotenv Another note, I cloned this repo in efforts to push up a pr, but I'll need access as a contributor @goatandsheep. Hope this helps |
Describe the bug
Cross-posting from the Expo repository: expo/expo#28933
To Reproduce
Steps to reproduce the behavior:
npx create-expo-app
cd my-app
npm install react-native-dotenv
npx expo start --ios
/app
(without the plugin, you will see tabs and theapp/(tabs)/index.tsx
screen.https://github.com/brentvatne/repro-dotenv
Expected behavior
react-native-dotenv should play nicely with expo-router.
Screenshots
n/a
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Given this incompatibility, we are currently recommending that developers using Expo Router use Expo CLI's built-in environment variable support.
I think that one way to fix this issue would be to change the default behavior to whitelisted env vars only. In my opinion, not having this default can be a footgun.
The text was updated successfully, but these errors were encountered: