【问题标题】:How to configure angular2-typescript application to run in VS Code如何配置 angular2-typescript 应用程序以在 VS Code 中运行
【发布时间】:2016-05-05 15:01:56
【问题描述】:

我真的迷路了,请帮我理解这个配置,

launch.json 
"configurations": [
        {
            "name": "Launch",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/workspace/angular/app/main.ts",

我看到“程序”属性的许多变体,但我不知道该属性的用途。

这是对我有用的唯一方法:

"program": "${workspaceRoot}/workspace/angular/node_modules/lite-server/bin/lite-server",

但它不会让我调试应用程序和浏览器打开 “http://localhost:3000”不是应用的完整地址

我看到的例子看起来像:

"program": "${workspaceRoot}/app/app.js",
"program": "${workspaceRoot}/app/app.ts",

但它永远不会运行,我收到“系统未定义”错误,main.ts 需要包含什么?

我什至看到了:

"程序": "http://localhost/blabla/index.html",

正确的方法是什么?

【问题讨论】:

    标签: typescript angular visual-studio-code


    【解决方案1】:

    您是否尝试过为 vscode 使用 Chrome 调试器扩展?

    1. 确保您已启用源映射
    2. 将这些配置添加到launch.json

    { "version": "0.1.0", "configurations": [ { "name": "Attach with sourcemaps", "type": "chrome", "request": "attach", "port": 9222, "sourceMaps": true, "url": "<url of the open browser tab, you wanna connect to" }, { "name": "Attach to url with files served from ./out", "type": "chrome", "request": "attach", "port": 9222, "url": "<url of the open browser tab, you wanna connect to", "webRoot": "${workspaceRoot}/out" } ] }

    1. 启动 Chrome 并启用远程调试,chrome --remote-debugging-port=9222

    【讨论】:

    • 感谢您的帮助,但这实际上是相当老的帖子,我切换到 Webstorm。
    猜你喜欢
    • 2021-05-05
    • 1970-01-01
    • 2016-04-01
    • 2019-05-11
    • 1970-01-01
    • 2020-03-18
    • 1970-01-01
    • 1970-01-01
    • 2016-06-12
    相关资源
    最近更新 更多