【发布时间】:2019-09-25 13:31:56
【问题描述】:
我们有一个 Angular 应用程序(Angular 8),代码设置在 Ubuntu 虚拟机上。 并使用 Visual Studio Code + Remote Development Tool (Microsoft) 进行开发。
虽然开发工作正常,但在调试应用程序时遇到问题。
launch.json 配置
{ "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "Launch Chrome", "url": "http://localhost:4200/#", "webRoot": "${workspaceFolder}", "sourceMaps": true, "runtimeArgs": ["--disable-session-crashed-bubble"] }, { "type": "chrome", "request": "attach", "name": "Attach to Chrome", "port": 9222, "address": "localhost", "webRoot": "${workspaceFolder}", "sourceMaps": true } ] }
用于端口转发的vscode命令:"Forward Port From Active Host"
用于开发环境的 angular.json 配置
{ "dev": { "optimization": false, "outputHashing": "all", "sourceMap": true, "extractCss": true, "namedChunks": true, "aot": true, "extractLicenses": true, "vendorChunk": true, "buildOptimizer": false, "fileReplacements": [ { "replace": "ui/environments/environment.ts", "with": "ui/environments/environment.ts" } ] } }
有了这个我可以从本地连接到远程,但是,“附加到 Chrome”无法找到文件并产生类似的错误
无法打开“dashboard.man~de6ca691.77f46380879a4a0699b4.js”:无法读取文件(错误:找不到文件 (vscode-remote://ssh-remote+angular_serve/kite/angular_proj/dashboard/dashboard.man~de6ca691.77f46380879a4a0699b4.js)。
这样的远程调试可行吗? 我是否缺少任何配置?
【问题讨论】:
标签: visual-studio-code angular8 vscode-debugger vscode-remote chrome-debugging