Debug & Run Angular2 Typescript with Visual Studio Code?

后端 未结 10 1136
情歌与酒
情歌与酒 2020-11-27 10:08

Debug & Run Angular2 Typescript with Visual Studio Code?

I am trying to debug Angular2 typescript application with VS code https://angular.io/gu

10条回答
  •  忘掉有多难
    2020-11-27 10:45

    This one is tried and tested -

    Step 1: Install chrome debugger: simply open the Command Palette (Ctrl+Shift+P) inside VS Code and type Extensions: Install Extension command. When the extension list appears, type 'chrome' to filter the list and install the Debugger for Chrome extension. You'll then create a launch-configuration file.

    [More Details of Step 1]

    Step 2: Create and update launch.json file: Two example launch.json configs with "request": "launch". You must specify either file or url to launch Chrome against a local file or a url. If you use a url, set webRoot to the directory that files are served from. This can be either an absolute path or a path using ${workspaceRoot} (the folder open in Code). webRoot is used to resolve urls (like "http://localhost/app.js") to a file on disk (like "/Users/me/project/app.js"), so be careful that it's set correctly. update Content of launch.json file as follows-

    {
        "version": "0.1.0",
        "configurations": [
            {
                "name": "Launch localhost",
                "type": "chrome",
                "request": "launch",
                "url": "http://localhost/some_name",
                "webRoot": "${workspaceRoot}/wwwroot"
            },
            {
                "name": "Launch index.html (disable sourcemaps)",
                "type": "chrome",
                "request": "launch",
                "sourceMaps": false,
                "file": "${workspaceRoot}/index.html"
            },
        ]
    }
    

    [More Details of Step 2]

提交回复
热议问题