Created
September 11, 2021 17:55
-
-
Save moreirapontocom/f46e7b6dd0f34c200543da8ad958e90d to your computer and use it in GitHub Desktop.
Debug React apps in VS Code with breakpoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start the task first running npm start or CMD+Shift+B (run build task) | |
// To disable React auto-launch in the default browser, I added "BROWSER=none" into the npm start script. | |
// Then run the debug session with F5. It will launch Chrome and breakpoints will work | |
// launch.json | |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Launch Chrome", | |
"request": "launch", | |
"type": "pwa-chrome", | |
"url": "http://localhost:3000", | |
"webRoot": "${workspaceFolder}" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tasks.json | |
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"type": "npm", | |
"script": "start", | |
"problemMatcher": [], | |
"label": "npm: start", | |
"detail": "react-scripts start", | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment