Skip to content

Instantly share code, notes, and snippets.

@BaezCrdrm
Created September 6, 2022 15:07
Show Gist options
  • Save BaezCrdrm/7638a38fec0f0976b246e2a241fe3a06 to your computer and use it in GitHub Desktop.
Save BaezCrdrm/7638a38fec0f0976b246e2a241fe3a06 to your computer and use it in GitHub Desktop.
React VS Code debugger

Debbug React App in VSCode

Chrome

Based on: https://dev.to/zirkelc/debug-a-react-app-in-vscode-21ga

1. Enable remote debugging

Add to the chrome shortcut "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 -- "%1" to the target field.

2. Add VS Code configuration

Add this configuration to the .vscode/launch.json file.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Chrome",
            "request": "launch",
            "type": "chrome",
            "url": "http://localhost:3000",
            "webRoot": "${workspaceFolder}"
        },
        {
            "name": "Attach to Chrome",
            "port": 9222,
            "request": "attach",
            "type": "chrome",
            "urlFilter": "http://localhost:3000/*", // use urlFilter instead of url!
            "webRoot": "${workspaceFolder}"
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment