-
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
Pass custom-placed metro.config.js through --config to run-android and run-ios commands #1371
Comments
@grabbou moving the discussion from this pr here since we are going to implement it withing this issue :)
|
@pepibumur maybe we could close this pr for now? |
Hey @ElviraBurchik, is this issue in work or what's the current status? |
Hey @flextremedev 👋 It's on hold for now |
So nobody's working on it right now? If so I could have a look at this as we're having the same problem. |
Right, this is our temporary solution too. Nobody is working on it right now on our side, but we could pair on this issue together if you want 🙂 |
Sure 🙂 |
I think it's a bug then. Rather than adding a The desired behaviour should be to read the config from the That's what happens when you run The fix would be to update this function
cwd . It probably uses the location of node_modules , since it's called here: cli/packages/platform-android/src/commands/runAndroid/index.ts Lines 95 to 99 in 0993f62
So TL;DR passing |
Thanks for the response @grabbou! However, I'm not sure if your suggestion works for our case. The issue is that we use |
@grabbou I'm having a similar problem, I believe the problem is that launchPackager.command (and packager.sh) from react-native assumes the project root differently from the CLI. It assumes the root is the folder where react-native is installed and cd's to it. My folder structure is:
And when I run both
and it starts the bundler, but it fails to bundle with the following message:
I don't see how the launchPackager.command uses cwd in any way. |
@duailibe did you ever figure this out? |
There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
Was this ever resolved? still seems like it's not supported.
I get |
Hey @jonrigerths2 this is broken in |
@szymonrybczak oh awesome, thanks!! |
Describe the Feature
At Shopify, we are using the React Native CLI in a monorepo setup:
Since the CLI launches the packager taking the directory where React Native lives as the working directory, it causes the packager command to try reading the Metro configuration from the wrong directory -
react-native-packages/node_modules/react-native
.I suppose that it could be solved by adding an option to provide a path to the custom
metro.config.js
when runningrun-ios
andrun-android
commands.Possible Implementations
I spent some time understanding the code base and find some possible implementations, but I struggle to find a place where Metro CLI actually gets called.
How I understand the process so far: runAndroid command runs
launchPackager.command
to start metro server.launchPackager.command
calls react-native-community/cli run, and from here I can't connect the dots how we run Metro CLI and start the server.I'd be happy to submit a pr for this feature request if somebody could point me out the right place for introducing these changes 😄🤞
Related Issues
facebook/metro#588
#1358
The text was updated successfully, but these errors were encountered: