lugg / react-native-config

Bring some 12 factor love to your mobile apps!
MIT License
4.82k stars 657 forks source link

New v1.5 has issues with CodePush #731

Open mi5ha opened 1 year ago

mi5ha commented 1 year ago

If binary to which CodePush is done contains v1.4 of react-native-config, and current code is updated to react-native-config v1.5, ENV variables are not set, they are undefined. If binary to which CodePush is done contains v1.5, everything works.

This is a serious issue if you need to CodePush to older binaries, as you usually do, or to several different binaries with different versions of react-native-config in them.

For now we have downgraded react-native-config to v1.4

Does anybody has an idea why this happens? Thank you

filipef101 commented 1 year ago

RN config changed the api in 1.5 I think. Your case is something not meant to be supported with codepush. Don't expect to push updated JS code to a previous/diffrent build that has different native code. If you want something similar you could use a metro based config loading that is not a native module

mi5ha commented 1 year ago

@filipef101 Got it, thank you for suggesting metro based config loading!

arthurgeron-work commented 1 year ago

Upgrading any library via codePush is generally not a good idea, specially because values of .env files are evaluated at build time and not runtime