Xcode has no way pass env variables to react-native server
See original GitHub issueDescription:
To start react-native server XCode has to run:
launchPackager.command
which starts new terminal emulator window- which runs
packager.sh
, this process as it runs in new terminal has no access to environment variables - to pass variables
.packager.env
file is created by XCode build script .packager.env
was sourced before starting react-native server https://github.com/facebook/react-native/commit/9ece5bda9bd035c31c3b975d1a8b66574dd43c4e#diff-fe2ea122979e8bb9729dff893828ae61L14
Our use case is to pass a path to another NODE_BINARY
as we want to run exact version with help of nodenv
(or nvm).
It seems that before https://github.com/facebook/react-native/commit/9ece5bda9bd035c31c3b975d1a8b66574dd43c4e#diff-fe2ea122979e8bb9729dff893828ae61L14 we could just pass NODE_BINARY
to .packager.env
.
My assumtion is that RCT_METRO_PORT
is now ignored and thus port cannot be customized.
React Native version:
System:
OS: macOS 10.15.3
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 2.40 GB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: ^16.9.0 => 16.9.0
react-native: ^0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
Steps To Reproduce
Expected Results
While building with XCode, build steps should be able to pass environment variables to configure react-native server.
Snack, code example, screenshot, or link to a repository:
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Setting environment variable in react-native? - Stack Overflow
I am using react-native to build a cross-platform app, but I do not know how to set the environment variable so that I...
Read more >Passing Environment Variable to React Native Main File
[Solved]-Passing Environment Variable to React Native Main File ... want. yarn add react-native config, set up using gradle, IOS has another method so...
Read more >How to Properly Use Environment Variables in an Expo React ...
An environment variable is a variable who's value is set from outside the program. This variable is made up of a key/value pair...
Read more >Setting up the development environment - React Native
Expo is a set of tools and services built around React Native and, ... how to install Xcode or set up your Android...
Read more >How to manage staging and production environments in ...
Use environment variables in React Native - learn how, here. Tagged with ... So manually specifying the .env file is not acceptable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chrmod can you edit your issue and make sure it uses the template provided? It’s the block of text that is prepopulated when you open a new issue. PRs always welcome.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.