首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VSCode不关闭子进程(processChild.js)

VSCode不关闭子进程(processChild.js)
EN

Stack Overflow用户
提问于 2021-02-25 22:15:36
回答 1查看 83关注 0票数 0

我刚刚注意到,在关闭调试器之后,VSCode并没有按照应该的方式关闭Node.js子进程。在调试器启动/停止5-10次之后,这些进程严重地开始消耗我的内存。

我正在使用最新的LTS nodejs和NVM的管理。

我不知道我的调试器配置是否有问题,或者是VSCode错误,但这是我的配置;

代码语言:javascript
复制
{
  "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"]
    }
  ]
}
EN

回答 1

Stack Overflow用户

发布于 2021-02-25 23:51:59

我发现只有当Launch via yarn在关闭Node Attach之前关闭时,问题才会发生。

为了防止错误的关闭顺序,我删除了Node Attach配置,转而使用Auto Attach特性。

这是我的配置的最新版本,供需要它的人使用;

代码语言:javascript
复制
{
  "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"]
    }
  ]
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66370233

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档