在项目根目录下创建.vscode文件夹
里面添加两个配置文件
vscode配置文件

tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
      {
        "label": "electron-debug",
        "type": "process",
        "command": "./node_modules/.bin/vue-cli-service",
        "windows": {
          "command": "./node_modules/.bin/vue-cli-service.cmd"
        },
        "isBackground": true,
        "args": ["electron:serve", "--debug"],
        "problemMatcher": {
          "owner": "custom",
          "pattern": {
            "regexp": ""
          },
          "background": {
            "beginsPattern": "Starting development server\\.\\.\\.",
            "endsPattern": "Not launching electron as debug argument was passed\\."
          }
        }
      }
    ]
  }

launch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Electron: Main",
        "type": "node",
        "request": "launch",
        "protocol": "inspector",
        "runtimeExecutable": "${workspaceRoot}/node_modules/electron/dist/electron.exe", 
        "windows": {
          "runtimeExecutable": "${workspaceRoot}/node_modules/electron/dist/electron.exe"
        },
        "preLaunchTask": "electron-debug",
        "args": ["--remote-debugging-port=9223", "./dist_electron"],
        "outFiles": ["${workspaceFolder}/dist_electron/**/*.js"]
      },
      {
        "name": "Electron: Renderer",
        "type": "chrome",
        "request": "attach",
        "port": 9223,
        "urlFilter": "http://localhost:*",
        "timeout": 30000,
        "webRoot": "${workspaceFolder}/src",
        "sourceMapPathOverrides": {
          "webpack:///./src/*": "${webRoot}/*"
        }
      }
    ],
    "compounds": [
      {
        "name": "Electron: All",
        "configurations": ["Electron: Main", "Electron: Renderer"]
      }
    ]
  }
Last modification:May 24, 2020
If you think my article is useful to you, please feel free to appreciate