Skip to content

Debugging Tools

v5 makes it very convenient to use the IDE's debugger, whether for JS or TS, debugging is easy.

Developer Tools

  1. In the running application interface, find View -> Toggle Developer Tools in the menu, click to open: Console tools.

  2. Enable Developer Tools in the configuration

Debug

Debug Configuration Files

You need to add two VS Code configuration files: .vscode/launch.json and .vscode/tasks.json

  1. Add configuration: .vscode/launch.json
json
{
  // VS Code debug configuration version
  "version": "1.0.0",
  "configurations": [
    {
      // Debug main process only (need to manually start frontend)
      "name": "Debug Electron",
      "type": "node",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
      "runtimeArgs": [
        "--inspect=9229",
        ".",
        "--env=local"
      ],
      "env": {
        "NODE_ENV": "dev"
      },
      "console": "integratedTerminal",
      "outputCapture": "std",
      "sourceMaps": true,
      "resolveSourceMapLocations": [
        "${workspaceFolder}/electron/**",
        "${workspaceFolder}/public/electron/**"
      ],
      "preLaunchTask": "ee-build-dev"
    },
    {
      // One-click start: frontend + main process debugging
      "name": "Debug Full App",
      "type": "node",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
      "runtimeArgs": [
        "--inspect=9229",
        ".",
        "--env=local"
      ],
      "env": {
        "NODE_ENV": "dev"
      },
      "console": "integratedTerminal",
      "outputCapture": "std",
      "sourceMaps": true,
      "resolveSourceMapLocations": [
        "${workspaceFolder}/electron/**",
        "${workspaceFolder}/public/electron/**"
      ],
      "preLaunchTask": "ee-dev-all"
    },
  ]
}
  1. Add configuration: .vscode/launch.tasks
json
{
  // VS Code task configuration version
  "version": "2.0.0",
  "tasks": [
    {
      // Build electron main process (dev environment, with inline sourcemap)
      "label": "ee-build-dev",
      "type": "shell",
      "command": "pnpm",
      "args": ["exec", "ee-bin", "build", "--cmds=electron", "--env=dev"],
      "group": "build",
      "problemMatcher": []
    },
    {
      // Start frontend development server (background)
      "label": "ee-frontend-dev",
      "type": "shell",
      "command": "pnpm",
      "args": ["dev-frontend"],
      "isBackground": true,
      "problemMatcher": {
        "pattern": { "regexp": "^$" },
        "background": {
          "activeOnStart": true,
          "beginsPattern": "VITE",
          "endsPattern": "ready in"
        }
      },
      "presentation": {
        "reveal": "silent",
        "panel": "shared"
      }
    },
    {
      // Composite task: first build electron, then start frontend + debug main process in parallel
      "label": "ee-dev-all",
      "dependsOn": ["ee-build-dev", "ee-frontend-dev"],
      "dependsOrder": "sequence",
      "problemMatcher": []
    }
  ]
}

Other Troubleshooting Methods

  • Run xxx.exe from the command line terminal (if the software is running abnormally, you can check for errors this way)