先决条件:Firebase和节点在本地机器中正确设置要求:1.我只需要在VSCode中单击“Start Debugging(F5)”一次,然后所有其他设置都将自动完成,我可以开始调试。1.当我在调试期间在编辑器中更改代码时,更改将立即部署并生效1.我可以保持启动和停止调试会话,而不用担心进程清理,因为它在结束调试会话后自动处理(Shift-F5)
44u64gxh1#
您只需要2个文件。一旦它们到位,您可以按F5开始调试,按Shift-F5停止调试Firebase函数。1.{项目根目录}/.vscode/启动.json
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "attach", "name": "Debug", "port": 9229, "restart": true, "skipFiles": ["<node_internals>/**"], "preLaunchTask": "start firebase emulator", "postDebugTask": "stop firebase emulator" } ] }
1.{项目根目录}/.vscode/任务.json
{ "version": "2.0.0", "tasks": [ { "label": "start firebase emulator", "type": "shell", "isBackground": true, // (1) This autocompiles if there is any code change and effective immediately. // (2) The single '&' ensures tsc -w (used in run build) will not block the emulator to start // (3) --inspect-function allows debugger to be attached "command": "npm --prefix ./functions run build -- -w & firebase emulators:start --inspect-functions", "presentation": { "reveal": "silent", "close": true }, "problemMatcher": [ { "pattern": [ { "regexp": ".", "file": 1, "line": 1, "column": 1, "message": 1 } ], "background": { "activeOnStart": true, "beginsPattern": { "regexp": "." }, "endsPattern": { "regexp": "." } } } ] }, { "label": "stop firebase emulator", "command": "echo ${input:terminate}", "type": "shell" } ], "inputs": [ { "id": "terminate", "type": "command", "command": "workbench.action.tasks.terminate", "args": "terminateAll" } ] }
1条答案
按热度按时间44u64gxh1#
您只需要2个文件。一旦它们到位,您可以按F5开始调试,按Shift-F5停止调试Firebase函数。
1.{项目根目录}/.vscode/启动.json
1.{项目根目录}/.vscode/任务.json