close
The Wayback Machine - https://web.archive.org/web/20201112011713/https://medium.com/@auchenberg/super-charged-live-editing-and-javascript-debugging-for-angular-using-visual-studio-code-c29da251ec71

Super-charged live editing and JavaScript debugging for Angular using Visual Studio Code ๐Ÿ”ฅ ๐ŸŽ‰

Use Visual Studio Code to super-charge your Angular JavaScript debugging workflow in a few simple steps

Image for post
Image for post
Demo of a click event handler in an Angular component being debugged and live edited from VS Code

Back in February I wrote a Medium post on How to Live edit and debug your React apps directly from VS Code powered by our Chrome debugger for VS Code and Webpackโ€™s Hot Module Reloading mechanism. Today Iโ€™m gonna show how you can achieve the same super-charged workflow for Angular by using angular-cli and Visual Studio Code.

Super-charged live editing and JavaScript debugging enables you to write and debug your Angular code without leaving the editor, and most importantly it enables you to have a more efficient development workflow, without context switching, because you stay inside your editor while you both author and debug ๐Ÿ”ฅ ๐ŸŽ‰ ๐ŸŽˆ

Image for post
Image for post

How to get started

  1. Make sure Chrome is at least version version 59 (see issue)
  2. Create your Angular app using angular-cli
  3. Create alaunch.jsonfile to configure the VS Code debugger and put it inside .vscode in your root folder.
VS Code launch.json configs for angular-cli

5. Start your Angular app by running ng serve in your favorite terminal.

6. Start debugging in VS Code by pressing F5or going to the debug section select Launch Chrome with ng serve followed by clicking the green debug icon.

Happy debugging! ๐ŸŽ‰๐ŸŽˆ

Debugging Angular unit tests with VS Code

Help VS Code understand your source-maps with an extra option

To overcome this we have introduced a sourceMapPathOverrides option which allows VS Code to override paths inside the source map. This is needed to map the files correctly to the file system, as our debugger relies on the source files for debugging. You can read more about sourceMapPathOverrides here.

Thatโ€™s it for now. Happy debugging! ๐ŸŽ‰๐ŸŽˆ

/k

Written by

Developer Experience @stripe / Alum @code , @microsoft , @citrix , @podio , @vodafone , @zyb / @WEF Global Shaper / @coldfrontconf founder / @goog

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store