引用自 react-create-app 的 doc
Visual Studio Code
You would need to have the latest version of VS Code and VS Code Chrome Debugger Extension installed.
Then add the block below to your launch.json
file and put it inside the .vscode
folder in your app’s root directory.
1 | { |
Note: the URL may be different if you’ve made adjustments via the HOST or PORT environment variables.
Start your app by running npm start
, and start debugging in VS Code by pressing F5
or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor.
Having problems with VS Code Debugging? Please see their troubleshooting guide.
WebStorm
You would need to have WebStorm and JetBrains IDE Support Chrome extension installed.
In the WebStorm menu Run
select Edit Configurations...
. Then click +
and select JavaScript Debug
. Paste http://localhost:3000
into the URL field and save the configuration.
Note: the URL may be different if you’ve made adjustments via the HOST or PORT environment variables.
Start your app by running npm start
, then press ^D
on macOS or F9
on Windows and Linux or click the green debug icon to start debugging in WebStorm.
The same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.