我刚刚注意到,在关闭调试器之后,VSCode并没有按照应该的方式关闭Node.js子进程。在调试器启动/停止5-10次之后,这些进程严重地开始消耗我的内存。
我正在使用最新的LTS nodejs和NVM的管理。
我不知道我的调试器配置是否有问题,或者是VSCode错误,但这是我的配置;
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via yarn",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "yarn",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Node Attach",
"port": 9229,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch firefox",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack://_n_e/pages/news",
"path": "${workspaceFolder}/pages/news"
},
{
"url": "webpack://_n_e/client/index.tsx",
"path": "${workspaceFolder}/pages/news/index.tsx"
},
{
"url": "webpack://_n_e/pages/haberler",
"path": "${workspaceFolder}/pages/haberler"
},
{
"url": "webpack://_n_e/components",
"path": "${workspaceFolder}/components"
}
]
}
],
"compounds": [
{
"name": "Combined debugger",
"configurations": ["Launch via yarn", "Node Attach", "Launch firefox"]
}
]
}发布于 2021-02-25 23:51:59
我发现只有当Launch via yarn在关闭Node Attach之前关闭时,问题才会发生。
为了防止错误的关闭顺序,我删除了Node Attach配置,转而使用Auto Attach特性。
这是我的配置的最新版本,供需要它的人使用;
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via yarn",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "yarn",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
"console": "integratedTerminal"
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch firefox",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack://_n_e/client/index.tsx",
"path": "${workspaceFolder}/pages/index.tsx"
},
{
"url": "webpack://_n_e/components",
"path": "${workspaceFolder}/components"
}
]
}
],
"compounds": [
{
"name": "Combined debugger",
"configurations": ["Launch via yarn", "Launch firefox"]
}
]
}https://stackoverflow.com/questions/66370233
复制相似问题