forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…xpo#33629) # Why Fixes expo#33483 `expo start`'s options are quite complicated and may load the app manifest when the project is using dev clients. Because the app manifest is loaded when resolving these options, we need to move the `.env` initialization before resolving these options. > Note, we can also split up the `resolveOptions` from `expo start`, but that would still require moving the `.env` init before resolving the dev client scheme. # How - Moved the `.env` loading mechanism before resolving the start options, into `src/start/index.ts` # Test Plan See added test # Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- Loading branch information
Showing
5 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
// Set the environment to production or development | ||
// lots of tools use this to determine if they should run in a dev mode. | ||
import * as env from '@expo/env'; | ||
|
||
/** | ||
* Set the environment to production or development | ||
* lots of tools use this to determine if they should run in a dev mode. | ||
*/ | ||
export function setNodeEnv(mode: 'development' | 'production') { | ||
process.env.NODE_ENV = process.env.NODE_ENV || mode; | ||
process.env.BABEL_ENV = process.env.BABEL_ENV || process.env.NODE_ENV; | ||
|
||
// @ts-expect-error: Add support for external React libraries being loaded in the same process. | ||
globalThis.__DEV__ = process.env.NODE_ENV !== 'production'; | ||
} | ||
|
||
/** | ||
* Load the dotenv files into the current `process.env` scope. | ||
* Note, this requires `NODE_ENV` being set through `setNodeEnv`. | ||
*/ | ||
export function loadEnvFiles(projectRoot: string, options?: Parameters<typeof env.load>[1]) { | ||
return env.load(projectRoot, options); | ||
} |