-
Notifications
You must be signed in to change notification settings - Fork 659
Description
Hey everyone, my set:
"react": "19.1.0",
"react-native": "0.80.1",
devDependencies:
"@react-native-community/cli": "19.0.0",
"@react-native-community/cli-platform-android": "19.0.0",
"@react-native-community/cli-platform-ios": "19.0.0",
"babel-plugin-react-compiler": "^19.1.0-rc.2",
I’m experiencing (what seems to be?) a non-standard caching issue that did not occur in previous versions of React Native.
Previously, on react-native: 0.76.9 and react: 18.3.1, I did not encounter this problem.
Context
My app uses a shared codebase but serves multiple clients/entities. I achieve this by using react-native-config to switch between .env files. Each flavor has different keys and assets (logos, etc.). So essentially, I have multiple apps with the same code, but different .env configurations and resources.
I build each version with a command like:
cd android && ./gradlew bundle[Appname]app
Problem
During build, the file:
android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java
somehow gets injected with stale .env data — specifically this block:
if (com.[company].[Appname].BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { DefaultNewArchitectureEntryPoint.load(); }
Now here’s the strange part:
• The [Appname] used in this file is outdated — it does not match the currently selected .env file.
• In fact, the outdated [Appname] no longer exists in any .env file, yet it still gets inserted into the generated Java class.
• Console logs during the Gradle build clearly show the correct current values.
• I also verified the build.gradle flavor setup:
flavorDimensions "env"
productFlavors {
project.ext.envConfigFiles.each { flavorName, _ ->
"$flavorName" {
dimension 'env'
}
}
}
Everything seems to be correct.
What I Tried:
• ./gradlew clean — did not help.
• Manually clearing the android/app/build directory — did not help.
• Only thing that helps: deleting yarn.lock and reinstalling with yarn install — which makes me suspect some kind of caching is happening inside node_modules.
From what I’ve read, autolinking is handled by the @react-native-community/cli package — so maybe it’s caching something unexpectedly?
Before opening an issue on the React Native repo, I wanted to ask here — maybe someone has encountered something similar?
Thanks in advance for any help, and have a great day! 🙌