2017-05-24 94 views
1

我开始学习角度并在Visual Studio中创建了一个简单的项目,并且它在那里运行良好。它只有一个html文件和一个单独的JS文件。我决定尝试使用Visual Studio Code,因为这看起来像是一个更好的编码前端工作环境。 但是对于我的生活,我无法让Chrome调试器显示页面。VS代码中的Chrome调试器扩展将不会显示HTML文件

这是当前launch.json(试了更改URL和根目录没有运气):

{ 
    "version": "0.2.0", 
    "configurations": [ 
     { 
      "type": "chrome", 
      "request": "launch", 
      "name": "Launch Chrome against localhost", 
      "url": "http://localhost:9222/index.html", 
      "webRoot": "${workspaceRoot}" 
     }, 
     { 
      "type": "chrome", 
      "request": "attach", 
      "name": "Attach to Chrome", 
      "port": 9222, 
      "webRoot": "${workspaceRoot}" 
     } 
    ] 
} 

我能得到铬启动和连接,但我得到一个完全空白页。然后我就可以去到localhost/JSON,给了我这样的:

[ { 
    "description": "", 
    "id": "2c0aed08-5bf3-4186-9ad6-9af1bc9e500c", 
    "title": "localhost:9222/index.html", 
    "type": "page", 
    "url": "http://localhost:9222/json" 
}, { 
    "description": "", 
    "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/ccfbea86-ec75-434e-9ae0-749eba4cbf2b", 
    "id": "ccfbea86-ec75-434e-9ae0-749eba4cbf2b", 
    "title": "Chrome Media Router", 
    "type": "background_page", 
    "url": "chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/_generated_background_page.html", 
    "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/ccfbea86-ec75-434e-9ae0-749eba4cbf2b" 
} ] 

我在这一点上什么尝试还是真的如何调试或看什么可能导致这种毫无头绪。任何帮助或方向将不胜感激。

回答

1

我不确定这是否是正确的答案。但更改launch.json以包括文件本身的工作。我现在可以在浏览器窗口中调试并查看我的寻呼机。同时开启诊断记录功能让我可以看到它是如何进行一些映射的。

{ 
    "name": "Launch Chrome", 
    "type": "chrome", 
    "request": "launch", 
    "url": "http://localhost:9222/", 
    "webRoot": "${workspaceRoot}\\", 
    "file": "${workspaceRoot}/index.html", 
    "diagnosticLogging": true 
}