Skip to content
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

Vendored Device class is broken when it comes to debugging #578

Closed
yard opened this issue Apr 23, 2024 · 3 comments · Fixed by #508
Closed

Vendored Device class is broken when it comes to debugging #578

yard opened this issue Apr 23, 2024 · 3 comments · Fixed by #508

Comments

@yard
Copy link

yard commented Apr 23, 2024

Environment

Nothing specific, an empty react-native project with installed repack (I have used 3.7.0, but other versions might be affected too).

Description

Vendored version of metro-inspector-proxy/src/Device.js is flawed: it does not handle Debugger.getScriptSource properly when the script URL is an actual URL, not a file path. Since it is the case for every development build (the script source is actually the URL to a bundler endpoint), Chrome DevTools would display an error message instead of the script source, making debugging impossible.

Conveniently enough, react-native developers have accounted for that in their implementation – I have tried replacing the Device class with the one taken from @react-native/dev-middleware package and it seems to be working flawlessly.

I am curious if there is any reason for using the vendored version?

Reproducible Demo

Try debugging any project with Chrome DevTools.

@jbroma
Copy link
Member

jbroma commented Apr 23, 2024

hi @yard, thanks for reporting that!

We're currently working on supporting the new experimental debugger in #508, not sure what's going to happen with legacy remote debugging since it's already deprecated in RN, so we might just leave Flipper + experimental debugger.

@RafikiTiki what's your take on this?

@yard
Copy link
Author

yard commented Apr 24, 2024

hi @jbroma, happy to help and thank you for amazing work on the library!
Please do let me know if I can help in any way.

@RafikiTiki
Copy link
Member

Hey @yard – as @jbroma mentioned we're currently migrating to the new package exposed by the RN corre team – @react-native/dev-middleware. Enabling the experimental debugger was the main reason for this change, but I'm glad it'll sort out your issue as well.

Since Remote Debugging will be removed by the RN core team, we won't be supporting this. We'll definitely treat the experimental debugger as the main focus. As for the Flipper, since it would have to be manually configured from the next version (https://reactnative.dev/blog/2023/12/06/0.73-debugging-improvements-stable-symlinks#flipper--react-native-integration) – it might need some additional configuration work that I'm not sure if should be done on the Repack or the consumer side – we'll see how this will play out once the experimental debugger changes are released in v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants