Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Android cliPath Gradle configuration option for build.gradle (#…
…31839) Summary: When using monorepo with react-native you need to provide `android/app/build.gradle` following params(`cliPath`): ``` project.ext.react = [ root: "../../../../", cliPath: "../../../../node_modules/react-native/cli.js", entryFile: "...", hermesCommand: "../../../../node_modules/hermes-engine/%OS-BIN%/hermesc" ] ``` With latest react-native `0.64.2` version you will get: ``` * What went wrong: Execution failed for task ':app:bundleReleaseJsAndAssets'. > Process 'command 'node'' finished with non-zero exit value 1 ``` Debugging this issue showed that providing `cliPath` options ends up building wrong path to cli: ``` > Task :app:bundleReleaseJsAndAssets FAILED node:internal/modules/cjs/loader:944 throw err; ^ Error: Cannot find module '/node_modules/react-native/cli.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15) at Function.Module._load (node:internal/modules/cjs/loader:774:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } ``` Changed `react.gradle` for proper File creation for `cliPath` to support this configuration option. ## Changelog [Android] [Fixed] - Changed `react.gradle` `detectCliPath` function logic for `cliPath` case Pull Request resolved: #31839 Test Plan: Run `./gradlew assembleRelease` or `./gradlew assembleDebug` Reviewed By: yungsters Differential Revision: D30877674 Pulled By: sshic fbshipit-source-id: 26b75f8d29bf26b01630dde576b9052d0b94d89e
- Loading branch information