Description
Is it possible to debug React Native projects?
I tried creating a new react-native
project:
expo init AwesomeProject
cd AwesomeProject
npm start # you can also use: expo start
And I registered the following debug template:
(dap-register-debug-template "Debug react-native example"
(list :type "chrome"
:cwd nil
:mode "url"
:request "launch"
:webRoot "/Users/myuser/Developer/AwesomeProject"
:url "http://localhost:19001/debugger-ui"
:name "Debug react-native example"))
When I execute dap-debug
, Chrome launches correctly, the mobile app connects correctly to the debugger (on Chrome it says Debuger session #0 active
), I see the Chrome session on dap-ui-sessions
and I see the out
window which correctly mirrors Chrome's console, but breakpoints remain in inactive state and they don't get hit.
I guess this configuration is never going to work and we need instead a dap-react-native
which uses the https://github.com/microsoft/vscode-react-native extension or https://github.com/jhen0409/react-native-debugger?
The official react-native docs Debugging · React Native mention something about using a custom javascript debugger
, but I guess it should be possible to use dap-mode
with Chrome?