Skip to content

Commit

Permalink
Fixed wrong usage of require when resolving supportsCodegenConfig
Browse files Browse the repository at this point in the history
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 callstack#652
  • Loading branch information
chrfalch committed Oct 10, 2024
1 parent e870106 commit 1ce8a3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package/react-native.config.js
Original file line number Diff line number Diff line change
@@ -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('.');
Expand Down

0 comments on commit 1ce8a3c

Please sign in to comment.