Skip to content

Commit a588df8

Browse files
authored
feat(expo): read .env file in upload script (#3571)
1 parent 6c91dce commit a588df8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
```
1919

2020
- Only upload Expo artifact if source map exists ([#3568](https://github.com/getsentry/sentry-react-native/pull/3568))
21+
- Read `.env` file in `sentry-expo-upload-sourcemaps` ([#3571](https://github.com/getsentry/sentry-react-native/pull/3571))
2122

2223
### Fixes
2324

scripts/expo-upload-sourcemaps.js

+9
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ function groupAssets(assetPaths) {
101101
return groups;
102102
}
103103

104+
process.env.NODE_ENV = process.env.NODE_ENV || 'development'; // Ensures precedence .env.development > .env (the same as @expo/cli)
105+
const projectRoot = '.'; // Assume script is run from the project root
106+
try {
107+
require('@expo/env').load(projectRoot);
108+
} catch (error) {
109+
console.warn('⚠️ Failed to load environment variables using @expo/env.');
110+
console.warn(error);
111+
}
112+
104113
let sentryOrg = getEnvVar(SENTRY_ORG);
105114
let sentryProject = getEnvVar(SENTRY_PROJECT);
106115
let authToken = getEnvVar(SENTRY_AUTH_TOKEN);

0 commit comments

Comments
 (0)