I Created a new Angular 6 CLI project
ng new myProjects
Created 'sub project'
ng g mySubProject
If I ng serve mySubProject then try to debug from VS Code using my normal launch.json, then breakpoints are not hit.
{
"name": "Launch Chrome (test)",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200/",
"webRoot": "${workspaceFolder}"
},
Can someone guide me how to set up my launch.json to debug sub-projects like this?
(for details on how I have my sub projects set up, it's based on a post here )
If I just ng serve, then this launch.json debigs the 'main' project OK - so I am guessing I need to set up somewhere in the launch.json to tell it where the child project is?
You can see a “Debug” button in the left side bar of visual studio code. Please click that button. It will automatically create a new “launch.
Now open Visual Studio Code. Go to "File" > "Open Folder" and select "First-Angular-Project" from the "Desktop". Now in the "TERMINAL" run ng new Angular-Project-Demo. Whenever it prompts with something like "Would you like to add Angular routing? (y/N)" press "y" and hit "ENTER".
Launch configurations. To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and VS Code will try to run your currently active file.
To debug a sub-project in an Angular 6.0 workspace: Set your launch.json configuration to look like:
{
"name": "ng serve my sub application",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200",
"webRoot": "${workspaceRoot}/projects/mysubapplication"
}
This means you will need a configuration entry for every sub application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With