0

如何实现 `au run --watch` 任务 + 调试中, Ashley Grant很好地概述了一种在 VS Code 中调试时启动浏览器的方法(与其他贡献者一起),但从评论中可以明显看出,源映射似乎不起作用. 确实,我开始使用那个帖子,但是作为一个同时使用 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}" } ] }

4

1 回答 1

0

不确定这是否是您正在寻找的,但这是我使用 VSC 在 Aurelia 应用程序中调试 JavaScript 的唯一方法。

仅适用于 Chrome,到目前为止还没有与 Firefox 一起使用。

JavaScript 文件必须打开并且它必须是 VSC 中的活动编辑器,调试器才能使用正确的路径。断点(仅)适用于同一目录中的所有 JavaScript 文件。

命令行:

au run --watch

启动.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}/.."
   },
   ...
于 2018-04-27T15:36:37.663 回答