2016-05-05 29 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