Skip to content

Instantly share code, notes, and snippets.

@plinionaves
Last active November 19, 2020 01:55
Show Gist options
  • Save plinionaves/c79c0ede5eafb8c75b442359ebf43b62 to your computer and use it in GitHub Desktop.
Save plinionaves/c79c0ede5eafb8c75b442359ebf43b62 to your computer and use it in GitHub Desktop.
VSCode + Chrome Debug in attached mode

VSCode + Chrome Debug

launch mode

  1. VSCode launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "name": "vuejs: chrome",
      "request": "launch",
      "breakOnLoad": true,
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "port": 9222,
      "skipFiles": ["<node_internals>/**"],
      "runtimeExecutable": "/usr/bin/google-chrome-stable",
      "sourceMapPathOverrides": {
        "webpack:///./src/*": "${webRoot}/*",
        "webpack:///src/*": "${webRoot}/*",
        "webpack:///*": "*",
        "webpack:///./~/*": "${webRoot}/node_modules/*"
      }
    }
  ]
}
  1. Set a breakpoint in VSCode and start debugging!

attached mode

  1. VSCode launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "attach",
      "name": "vuejs: chrome",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "port": 9222,
      "skipFiles": ["**/node_modules/**"],
      "sourceMaps": true,
      "sourceMapPathOverrides": {
        "webpack:///./src/*": "${webRoot}/*"
      }
    }
  ]
}
  1. Run chrome with this flag:
  • Linux/Mac: google-chrome-stable --remote-debugging-port=9222
  • Windows: start chrome --remote-debugging-port=9222
  1. Set a breakpoint in VSCode and start debugging!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment