2016-05-05 35 views
1

我真的失去了这里,请帮助我理解这个配置,如何配置angular2,打字稿应用程序在VS代码运行

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需要到c ontain?

我甚至看到:

“程序”: “http://localhost/blabla/index.html”,

什么正确的方式?

回答

0

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

  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" } ] }

启用
  • Chrome启动远程调试,chrome --remote-debugging-port=9222
  • +0

    感谢您的帮助,但这是实际Ÿ很漂亮的旧帖子,我转而使用Webstorm。 – Avi