在How to implement `au run --watch` task + debugging Ashley Grant中很好地概述了在VS代码中调试时启动浏览器的方法(以及其他贡献者),但是在注释中显而易见,源代码映射似乎不起作用。事实上,我接受了这个帖子,但是作为VS Code和Aurelia的n00b,我想知道是否有人有想法可以使它工作?目前我只有JS代码,但是可以理解那个或TypeScript助手和指针。
以防万一,这是
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "au",
"isShellCommand": true,
"tasks": [
{
"taskName": "watch",
"suppressTaskName": true,
"args": [
"run",
"--watch"
],
"isBuildCommand": false,
"isBackground": true,
"problemMatcher": {
"owner": "au",
"severity": "info",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "__________",
"file": 1
},
"watching": {
"activeOnStart": true,
"beginsPattern": "^File Changed: (.*)",
"endsPattern": "/(?:BrowserSync Available At:)|(?:Finished 'reload')"
}
}
}
]
}
这是 launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:9002",
"webRoot": "${workspaceRoot}",
"preLaunchTask": "watch"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 3003,
"webRoot": "${workspaceRoot}"
},
{
"type": "firefox",
"request": "launch",
"name": "Launch Firefox against localhost",
"url": "http://localhost:9002",
"webRoot": "${workspaceRoot}",
"preLaunchTask": "watch"
},
{
"type": "firefox",
"request": "attach",
"name": "Attach to Firefox",
"port": 3003,
"webRoot": "${workspaceRoot}"
}
]
}
答案 0 :(得分:0)
不确定这是否是您正在寻找的,但这是我使用VSC在Aurelia应用程序中调试JavaScript的唯一方法。
仅适用于Chrome,到目前为止还没有运气。
必须打开JavaScript文件,它必须是VSC中的活动编辑器,调试程序才能使用正确的路径。断点将(仅)用于同一目录中的所有JavaScript文件。
命令行:
au run --watch
launch.json:
"configurations": [
{
"type": "chrome",
"request": "launch",
"sourceMaps": true,
"trace": true,
"name": "Aurelia App in Chrome (for currently open JavaScript file)",
"url": "http://localhost:9000/index.html",
"webRoot": "${fileDirname}/.."
},
...