Skip to content

Instantly share code, notes, and snippets.

@cmckni3
Last active January 30, 2024 22:25
Show Gist options
  • Save cmckni3/c0429eada7a16813d182e5ce10a7ace2 to your computer and use it in GitHub Desktop.
Save cmckni3/c0429eada7a16813d182e5ce10a7ace2 to your computer and use it in GitHub Desktop.
Visual Studio code debugger configuration @angular/cli
  1. Install node.js and optionally yarn
  2. Install and open Visual Studio Code
  3. Install chrome debugging extension for Visual Studio Code
  4. Install @angular/cli npm i -g @angular/cli OR yarn global add @angular/cli
  5. Create a new project ng new my-project
  6. Open project in Visual Studio Code
  7. Debug > Add configuration
  8. Paste contents of launch.json into the new launch.json configuration file.
  9. Start project ng serve optionally changing the port with -p <value> or --port. Remember to change the port in launch.json first since Visual Studio Code will reload and stop all programs running in the builtin terminal.
  10. Debug > Launch Chrome against localhost
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceRoot}"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceRoot}"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment