Skip to content

Commit 32ffacc

Browse files
fix: use require.resolve for package root instead of __dirname
__dirname resolves differently from src/ vs lib/commonjs/ after compilation. Using require.resolve to find the package.json ensures the native module's android/build.gradle is found correctly regardless of the build output directory structure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5eb1409 commit 32ffacc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/expo-plugins/withAndroidPushNotifications.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ const writeFirebaseService: ConfigPlugin<IntercomPluginProps> = (_config) =>
7979
// service lives in the app module, we need firebase-messaging on the
8080
// app's compile classpath too. We read the version from the native
8181
// module's build.gradle so it stays in sync automatically.
82+
const packageRoot = path.resolve(
83+
require.resolve('@intercom/intercom-react-native/package.json'),
84+
'..'
85+
);
8286
const nativeBuildGradle = fs.readFileSync(
83-
path.join(__dirname, '..', '..', 'android', 'build.gradle'),
87+
path.join(packageRoot, 'android', 'build.gradle'),
8488
'utf-8'
8589
);
8690
const versionMatch = nativeBuildGradle.match(

0 commit comments

Comments
 (0)