-
Notifications
You must be signed in to change notification settings - Fork 905
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
Running an app in debug should not fail due to other apps running packager #1209
Comments
I'd be super supportive to merge a PR adding that 👍 |
cc @fson to consult changes to |
One thing that needs to be taken into consideration is that when building e.g. android, the port is defaulted to 8081 as well and you're only able to connect with Metro on that very port. So when you start Metro separately, you'd need to adjust build command to have the correct |
Thanks for the comments @thymikee . About Android, I need to familiarize myself more on that flow, but iOS is using this |
Changes to statusPageMiddleware stops packager bundling for debug builds. Packager status is checked within react native as well: https://github.com/facebook/react-native/blob/382f0898cf4112e64150c3b771e85df53ae86575/React/Base/RCTBundleURLProvider.mm#L98 After changing it there, it works. It could be like this to avoid making it a breaking change: -- Optionally, if there is a better way/place to get the project root for running packager instance, open to other ideas.. |
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. |
@plrdev are you still interested in this feature? I'm gonna reopen, because it's clearly beneficial to have this |
Hey thanks for the reminder on this. I'd be willing to work on this but I think I'd like to check this together with someone with the experience on the repo/codebase. Anyone willing to give some guidance and discuss this further? |
Asked internally if someone finds some time to help on this. Let's see how it goes :) |
this sounds nice. sorry if this is the wrong place to ask but is there a way to plug the port into the xcode build process in version 0.66? right now i have a shell script running in an xcode build phase called "Start Packager" that runs the i believe this is because my script uses |
Finally I think we can close this issue as I implemented this as part of #2021. Shipping with React Native 0.73 🚀 |
Describe the Feature
Running new app should work no matter if there has been other apps running (with packager) - ideally they would not collide.
Currently if you have an app already running in debug, it has it's packager running (by default in port 8081). When you try to run a second app, it will not spawn a launcher due to finding 8081 part having a packager already running. This will try to run the second app in the first apps packager, which will fail with an error:
This is unnecessary friction and requires manually killing the terminal each time you are switching to dev another application (or define the port yourself).
Possible Implementations
I did a twitter poll to see the expectations, here are the results
This confirmed my own feeling: Best option would be not to mess with the already running app. Instead, we would find a new port to run it.
I did some experimentations and based on those here is my proposed solution:
--port
is used and is not the default (8081) try to use the specified port. If it is in use, we don't launch packager - you are manually requesting the port and we don't want to change itThis would replace the current logic:
running
, don't do anythingPOC
I have a POC for iOS locally very close to working, but I wanted to make sure this would be something that is wanted before going forward and finishing it. Android side of implementation is pending still as well.
Changes required so far:
cli-server-api
statusMiddleWare (/status
), so it returns JSON with running status and projectRoot (so we can later check if the running packager is for the current project or not)Any comments on the proposed solution? Some reasons why it wouldn't work or not wanted to have in the first place? Any changes requested / required? Good to go? If all is good, I'll keep working on this and make a PR out of it.
The text was updated successfully, but these errors were encountered: