I am using PhpStorm and trying to automate the run with specific env variable. Managing .env variables for dev, staging, prod is very time saving and safe. So when I run set ENVFILE=.env.staging && react-native run-android
from terminal, it picks the .env.staging
variables but then I am not able to debug react-native app from PhpStorm. I am using react-native-config package.
When I run with this config it always picks from .env
file.
Then I tried to run with package.json scripts like
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"android-dev": "set ENVFILE=.env.staging",
"android-staging": "set ENVFILE=.env.staging && react-native run-android",
"android-prod": "set ENVFILE=.env.prod && react-native run-android",
"build-android-prod": "set ENVFILE=.env.prod && cd android && ./gradlew assembleRelease && cd .."
}
Although it opens the debug tab when I run debug with PhpStorm debug, but it was not showing debug variables.
So what I want is that clicking the Run/Debug choose the correct .env
file and I will able to debug React Native app from PhpStorm.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.