DEV Community

Olivier MARTINET
Olivier MARTINET

Posted on

3

Run & Debug Angular app on VS Code

Prerequisite

Alt Text

Step 1 launch.json

Create 'chrome task' configuration

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run & debug my app on chrome",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:4200/",
            "webRoot": "${workspaceFolder}",
            "preLaunchTask": "start"
        }
    ]
}

Step 2 tasks.json

{
    "version": "2.0.0",
    "tasks": [
     {
       "label": "start",
        "type": "npm",
        "script": "start",
        "isBackground": true,
        "presentation": {
          "focus": true,
          "panel": "dedicated"
        },
        "problemMatcher": {
          "owner": "typescript",
          "source": "ts",
          "applyTo": "closedDocuments",
          "fileLocation": [
            "relative",
            "${cwd}"
          ],
          "pattern": "$tsc",
          "background": {
            "activeOnStart": true,
            "beginsPattern": {
              "regexp": "(.*?)"
            },
            "endsPattern": {
              "regexp": "Compiled |Failed to compile."
            }
          }
        }
      }
    ]
  }

Step 3 Run debugger

  • press F5

Alt Text

References

[VsCode-tasks] https://code.visualstudio.com/docs/editor/tasks#_custom-tasks

Jetbrains image

Don’t Become a Data Breach Headline

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. Is your CI/CD protected? Check out these nine practical tips to keep your CI/CD secure—without adding friction.

Learn more

Top comments (0)

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay