簡體   English   中英

如何配置angular2-typescript應用程序以在VS Code中運行

[英]How to configure angular2-typescript application to run in VS Code

我真的迷失在這里,請幫助我理解這個配置,

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需要包含什么?

我甚至看到:

“program”:“ http://localhost/blabla/index.html ”,

這是正確的方式?

您是否嘗試過為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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM