VSCode
Tasks
对于调试 页面 前需要启动某个进程是否有用,可以不必在 launch 中配置或手动执行
https://vcfvct.wordpress.com/2019/01/11/debug-browser-code-in-vscode/
配置与 launch 稍有不同,可直接调用 npm
参考此处:https://github.com/microsoft/vscode-recipes/blob/master/vuejs-cli/README.md#serve—debug-at-once
problemMatcher 相当于提取 shell log 的信息来在 vscode 中输出警报,beginsPattern 则为该任务的开始 log,endsPattern 则为该任务的 终止/暂停log,匹配 endsPattern 则表示当前 task 执行完成
{
"version": "2.0.0",
"tasks": [
{
"label": "@formily/react: start",
"type": "npm",
"script": "start",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/packages/react",
},
"problemMatcher": {
"base": "$tsc-watch",
"background": {
"activeOnStart": true,
"beginsPattern": "Starting development server",
"endsPattern": "Compiled successfully"
},
},
}
]
}
配套 launch
{
// https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"name": "server @formily/react",
"request": "launch",
"port": 9001,
"url": "http://localhost:8000",
"webRoot": "${workspaceFolder}/packages/react",
"breakOnLoad": true, // !需要为 true,不然页面 load 期间的 debugger 会被直接跳过
"skipFiles": [
"${workspaceFolder}/node_modules/umi/**/*.js",
"<node_internals>/**"
],
"preLaunchTask": "@formily/react: start",
},
],
}
关注:
chrome debugger 依旧步进入 ignore list 文件
https://stackoverflow.com/questions/68424845/why-is-chrome-stepping-into-ignored-files