Bre*_*all 5 debugging visual-studio-code serverless-framework
在 VSCode 中调试基于无服务器的应用程序时,我的断点均未处于活动状态。
启动.json
{
"configurations": [
{
"console": "integratedTerminal",
"cwd": "${workspaceRoot}",
"name": "Debug",
"port": 5858,
"request": "launch",
"runtimeArgs": [
"run-script",
"vscode:debug"
],
"runtimeExecutable": "npm",
"type": "node"
}
],
"version": "0.2.0"
}
Run Code Online (Sandbox Code Playgroud)
我的package.json
...
"scripts": {
...
"vscode:debug": "export SLS_DEBUG=* && node --inspect=5858 --debug-brk --nolazy ./node_modules/.bin/serverless invoke local -s local -f customerAlexa -p ./test/requests/FindAgent-First-GoodZip.json"
},
....
Run Code Online (Sandbox Code Playgroud)
当我从菜单中选择“开始调试”时,所有红色断点都会变成灰色,并且程序只会执行而不会在断点处停止。
我在 Mac 上运行 Node 6.11.2、Serverless 1.23.0。谢谢大家。
小智 0
这是我的 launch.json,它允许我使用断点。
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/node_modules/.bin/serverless",
"args": [
"offline",
"start",
"--skipCacheInvalidation"
],
"env": {
"NODE_ENV": "development"
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 serverless-offline 在本地运行。我也在使用 webpack 和 babel。就是 skipCacheInvalidation为了这个。
我希望这能为您指明正确的方向。
| 归档时间: |
|
| 查看次数: |
1981 次 |
| 最近记录: |