facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.24k stars 626 forks source link

Metro bundler does not reopen app on Windows Subsystem for Android #939

Open rhyst opened 1 year ago

rhyst commented 1 year ago

Do you want to request a feature or report a bug?

Feature? Not sure if WSA is supported at the moment.

What is the current behavior?

I am running an android build in Windows Subsystem for Android. If I press r to reload in the metro bundler cli then app will close and will not reopen. Pressing a to Run on android rebuilds and the app opens.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

I think it should reopen when pressing r.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

Node: v18.12.1 NPM: 8.19.2 Metro: v0.73.7 OS: Windows 11 (Running the metro bundler in WSL, and the application in WSA).

robhogan commented 1 year ago

The handling of those keyboard shortcuts isn't actually part of Metro - it's implemented by @react-native-community/cli that wraps Metro, here.

For the app to "close and not reopen" is strange though, and might be a React Native issue (not Metro or CLI). Do you mean that it goes back to a white screen, but doesn't load the bundle, or that it closes all the way back to your Android home screen? The latter shouldn't happen - that suggests it's crashing.

rhyst commented 1 year ago

Ah, should I open an issue there instead?

I don't know if you have used Windows Subsystem for Android but there is no home screen which maybe is part of the problem. Each Android app runs in its own window and when it closes it is simply gone.

I experimented a bit and if I reload the app (so it closes) and then make changes to the app source and then reopen the application from the windows start menu then it does include the changes so I doesn't seem like anything is crashing, maybe just minimising in a weird way because of the lack of home screen?