Skip to content

Instantly share code, notes, and snippets.

@ryansutc
Last active January 4, 2020 22:04
Show Gist options
  • Save ryansutc/ab66544544a8b6dcd7f3b986ed54548f to your computer and use it in GitHub Desktop.
Save ryansutc/ab66544544a8b6dcd7f3b986ed54548f to your computer and use it in GitHub Desktop.
How to Set up VSCode Remote Debugging with a React App

Break and Step-through App in VSCode with Chrome Dev Tools

Sometimes it's nice to be able to step through code directly in VSCode, setting breakpoints and watching variables. Here's tentatively how you can do it with our React app:

  1. Install VSCode Extension Debugger for Chrome.

  2. Add Configuration to your Launch.json as per below to launch Chrome [Source]

  3. Add argument for "runtimeArgs" as per github suggestion here to get your Redux extension running in the VSCode Chrome browser.

*Your launch file should look something like below:

{
  "type": "chrome",
  "request": "launch",
  "name": "Launch Chrome",
  "url": "http://localhost:3000",
  "webRoot": "${workspaceFolder}",
  "runtimeArgs": ["--load-extension=${env:userprofile}/AppData/Local/Google/Chrome/User Data/Default/Extensions/lmhkpmbekcpmknklioeibfkpmmfibljd/2.17.0_0"]
}
  1. Set a breakpoint, press f5 to launch.
@ryansutc
Copy link
Author

ryansutc commented Jan 4, 2020

If you want to warm reload websites and allow step through debugging with docker you need to set CHOKIDAR_USEPOLLING=true in your environment:
facebook/create-react-app#4143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment