lugg / react-native-config

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

Changes only propagate if I remove derived data #774

Open ToshKoevoets opened 10 months ago

ToshKoevoets commented 10 months ago

Every time I rebuild with different .env values in the IOS simulator I have to delete deriveddata, which makes rebuilding slow; also takes a long time for developers to figure out, hence bunch of issues saying it either doesn't work, have to run pod install etc.

rm -rf ~/Library/Developer/Xcode/DerivedData
macrozone commented 10 months ago

i just run into the same problem, is this a new? I had the impression it worked before without deleting derivedData

midrizi commented 10 months ago

@luancurti

Same issue, initially suspected it might be related to our project. However, after testing 'Example/0.68.5', it appears the issue is not project-related.

januswel commented 10 months ago

I have added the script to delete the build cache before every building

image

This works file!!

ToshKoevoets commented 10 months ago

For prod it's a good idea, for dev would make it unnecessarily slow

Op do 7 sep 2023 om 11:58 schreef Takagi Kensuke @.***>:

I have added the script to delete the build cache before every building [image: image] https://user-images.githubusercontent.com/43239/266280119-77cfc63d-8ec9-42d9-9ee7-633ad9a4e6a1.png

This works file!!

— Reply to this email directly, view it on GitHub https://github.com/luggit/react-native-config/issues/774#issuecomment-1709864979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEFAD4EWYHE4B7BVDBZWDXZGLDBANCNFSM6AAAAAA37SCGUI . You are receiving this because you authored the thread.Message ID: @.***>

uwbobanminic commented 9 months ago

I'm having the same issue, but fixed it in suggested way on deleting rn-config cache.

Question is, do you know why this is happening?

januswel commented 9 months ago

@uwbobanminic

react-native-config generates a native-readable source file for each platform, before building

That's why deleting the cache works so well

I think it would be good to add a comparison the last modification time of .env and the one of the last build, and regenerates if those are different

vishuTheDevloper commented 9 months ago

ToshKoevoets macrozone januswel uwbobanminic midrizi The easiest way for now is to add script rm "${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/GeneratedDotEnv.m" This will not hamper your derived folder

Just add this script inside build phase click + and then New run script phase ->> Then add The above line but make sure to place the script at top of every one

if you have multiple Targets then add in each target Build phase same script Attaching screen shot reference

Screenshot 2023-10-06 at 6 14 44 PM

natemartins commented 8 months ago

Please, how can this be done for Android?

7dp commented 6 months ago

In my experience i need to clean my build everytime i switch to another scheme before running it on the device using XCode. Sure this slowing down the build time significantly.

7dp commented 6 months ago

But if i run the app through the cli without cleaning the build then it works. I don't to need to clean the build everytime i switch between scheme. I run it like this:

ENVFILE=.env.production react-native run-ios --scheme 'YourProdScheme'

So for now i always run the ios app through the cli and doesn't therough XCode.

Hope it helps someone, thanks.

Dokome commented 1 month ago

ToshKoevoets macrozone januswel uwbobanminic midrizi The easiest way for now is to add script rm "${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/GeneratedDotEnv.m" This will not hamper your derived folder

Just add this script inside build phase click + and then New run script phase ->> Then add The above line but make sure to place the script at top of every one

if you have multiple Targets then add in each target Build phase same script Attaching screen shot reference

Screenshot 2023-10-06 at 6 14 44 PM

Thanks, This help me a lot