From 1ce8a3c5a0a5f9dd27910c9b1f09f4f47bcc5b52 Mon Sep 17 00:00:00 2001 From: chrfalch Date: Thu, 10 Oct 2024 13:07:59 +0200 Subject: [PATCH] Fixed wrong usage of require when resolving supportsCodegenConfig When resolving the version inside `react-native-config` which is used by the autolinking gradle tasks, the wrong use of require was used. This fix changes from using `require.main.require` -> `require`. The difference is that require.main.require resolves from the entry point (main script), while require resolves from the location of the current file. Closes #652 --- package/react-native.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/react-native.config.js b/package/react-native.config.js index caf2479c..dc721a64 100644 --- a/package/react-native.config.js +++ b/package/react-native.config.js @@ -1,6 +1,6 @@ let supportsCodegenConfig = false; try { - const rnCliAndroidVersion = require.main.require( + const rnCliAndroidVersion = require( '@react-native-community/cli-platform-android/package.json', ).version; const [major] = rnCliAndroidVersion.split('.');