-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify setup for monorepos #877
Comments
this is my error when building Error: Cannot find module '/app/packages/app/node_modules/react-native/cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
} as it searches for react-native in the wron glocation |
I've got this working like this project.ext.react = [
entryFile: "index.js",
bundleInStaging: true,
devDisabledInStaging: true,
bundleInAlpha: true,
devDisabledInAlpha: true,
enableHermes: false, // clean and rebuild if changing
+ root: "../../../../"
] modifying but this raised another issue error Invalid platform "android" selected.
info Available platforms are: "native". If you are trying to bundle for an out-of-tree platform, it may not be installed. it only shows the what is the proper solution for this? |
fixed android like this project.ext.react = [
cliPath: "../../node_modules/react-native/cli.js",
] |
ios also need this export NODE_BINARY=node
export PROJECT_ROOT="$PROJECT_DIR/.."
../../../node_modules/react-native/scripts/react-native-xcode.sh |
Yeah, in my experience, this is the major root cause for all of the monorepo issues that a lot of people are facing these days. Any idea how we could plug into it? Setting dynamically variables? |
this is a hard one, maybe a monorepo documentation guide could be good enough |
In my case it was
Because project structure is:
|
@sibelius, following up to my discussions #656 (comment), we should be able to safely remove In theory, we always want it to be |
If you look at the details of the commit that introduced this change - facebook/react-native@9ccde37, I believe its assumptions are no longer true and we can get rid of it. Waiting for Janic to get back to me whether this is right and I believe we can follow up with a PR. This particular change shouldn't require anything on the CLI side. |
The ideal for me is this on iOS, regardless of your step
|
As per Janic's comment, we're good to go with the suggested changes. I will proceed with them soon and link a PR that is landing in React Native as a result. |
Just filled in React Native PR - facebook/react-native#28354. Appreciate your review and support in additional explanations :) |
Did anyone got build working with hermes enabled in a monorepo? I've got hermes to work by telling react where it's files are: This solved the initial issue of not being able to build becasue hermes executable was not found, however with this fix in place build is still failing with:
...because it is looking for Building works with Any suggestion how to get around this? My full react config from gradle:
EDIT:
EDIT2 / SOLUTION:
This got me pass the issue with
...so this time code-push is looking node_modules in wrong location. I think this issue is out of scope here, so I guess I should check Microsoft's github regarding this. |
Following @tad3j answer, using react-native 0.63.2 I had to change hermesCommand.
Changed to:
I still need to pass all other configuration, composeSourceMapsPath, cliPath and hermesCommand. Not passing composeSourceMapsPath was throwing a error. My monorepo configuration is more or less like this, trying to not use nohoist at all.
My final build.gradle project.ext.react is the following:
|
Has anyone that uses monorepos been able to get Sentry to work? I posted there but figured I'd ask here as well. I followed the examples in here for project.ext.react and it has solved everything except Sentry source maps. |
@eliw00d Yes, we do, I'll post on the Sentry ticket since it's specific to that. |
Had issues with ios not finding index.js entry with solutions above, what ended up working is
|
after days trying to fix the problem finally this worked for me |
good enough for me |
Describe the Feature
On iOS, you need to set
PROJECT_ROOT
in order to make CLI work in a monorepo. On Android, same set of configuration is required.Possible Implementations
PROJECT_ROOT
on iOS because it's not needed anymoreRelated Issues
related to #865 #656
The text was updated successfully, but these errors were encountered: