microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
e574eae01cbbbc457f1add5e8e23d40ea0549275

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

doc/debugging.md

100lines · modecode

1# Setting up debug environment
2
3Once you have set up a `launch.json` file with default configurations, you can modify these configurations, or add new ones to the list. You can use other fields in these configurations as well.
4
5![React Native launch configuration file](../images/launch-config.png)
6
7For example, you can modify the `target` field to specify the simulator you want to target for iOS debugging or the device using the one from output of `adb devices` command for Android debugging.
8
9## Debugging with TypeScript and Haul
10
11If you use Haul instead of the react-native packager, you must add `sourceMapPathOverrides` to the `launch.json` file.
12
13For example:
14```
15"sourceMapPathOverrides": {
16 "webpack:///./~/*": "${workspaceRoot}/node_modules/*",
17 "webpack:///./*": "${workspaceRoot}/*",
18 "webpack:///*": "*"
19}
20```
21See more about source map overrides [here](https://github.com/Microsoft/vscode-node-debug2#sourcemappathoverrides)
22
23## Specifying scheme for iOS app
24
25If you want to use custom scheme for your application you can either pass it as part of `runArguments` parameter arguments or set `scheme` configuration parameter as shown below:
26```js
27"runArguments": ["--scheme", "customScheme", ...]
28// or
29"runArguments": ["--scheme=customScheme", ...]
30// or
31"scheme" : "customScheme"
32```
33Please be aware, specifying scheme value as a part of `runArguments` parameter arguments will override `scheme` configuration parameter value if it set.
34
35## Debugging on iOS device
36
37Debugging on an iOS device require following manual steps:
38* Install [ios-deploy](https://www.npmjs.com/package/ios-deploy) `npm install -g ios-deploy`.
39* Have a valid iOS Development certificate installed.
40* In your project's `launch.json` file set `target` to `device` or use 'launchArguments' property to specify particular device to run on in case of multiple devices connected, e.g. `"runArguments": [ "--device", "My iPhone" ]`
41* Choose **Debug iOS** configuration from the Configuration dropdown and press F5.
42* Shake the device to open the development menu and select "Debug JS Remotely".
43
44## Debugging React Native Windows
45
46For UWP apps use `windows` target platform in `launch.json` configuration, e.g.:
47
48```
49{
50 "name": "Debug UWP",
51 "cwd": "${workspaceFolder}",
52 "type": "reactnative",
53 "request": "launch",
54 "platform": "windows"
55}
56```
57
58For WPF apps use `wpf`, e.g.(WPF debugging available only for react-native-windows gt 0.55.0):
59
60```
61{
62 "name": "Debug WPF",
63 "cwd": "${workspaceFolder}",
64 "type": "reactnative",
65 "request": "launch",
66 "platform": "wpf"
67}
68```
69
70## Debugging React Native apps with Hermes enabled
71
72Hermes is the new JavaScript engine optimized for running React Native apps on Android. It improves app performance and decreases app size.
73
74Click [here](https://facebook.github.io/react-native/docs/hermes/) to learn more about Hermes.
75
76Debugging apps with Hermes enabled is currently experimental. Please, see [this issue](https://github.com/microsoft/vscode-react-native/issues/1073) for current known issues on Hermes support.
77
78To debug while using Hermes engine, please choose one of the following debug configurations:
79 - React Native (Hermes): Debug Android - Experimental
80
81```
82{
83 "name": "Debug Android (Hermes) - Experimental",
84 "cwd": "${workspaceFolder}",
85 "type": "reactnativedirect",
86 "request": "launch",
87 "platform": "android"
88}
89```
90
91 - React Native (Hermes): Attach to Hermes application - Experimental
92
93 ```
94{
95 "name": "Attach to Hermes application - Experimental",
96 "cwd": "${workspaceFolder}",
97 "type": "reactnativedirect",
98 "request": "attach"
99}
100```