From ab6d089aa620db6febadce8726e70b8112b2d2d4 Mon Sep 17 00:00:00 2001 From: alex8088 <244096523@qq.com> Date: Mon, 29 Aug 2022 18:35:46 +0800 Subject: [PATCH] docs: update --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index f7ade72..2f22c0f 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,31 @@ function createWindow() { } ``` +### Debugging in VSCode + +Add a file `.vscode/launch.json` with the following configuration: + +```json +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Main Process", + "type": "node", + "request": "launch", + "cwd": "${workspaceRoot}", + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite", + "windows": { + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd" + }, + "runtimeArgs": ["--sourcemap"] + } + ] +} +``` + +Then, set some breakpoints in `main.ts` (source code), and start debugging in the `VSCode Debug View`. + ### Getting Started Clone the [electron-vite-boilerplate](https://github.com/alex8088/electron-vite-boilerplate) or use the [create-electron](https://github.com/alex8088/quick-start/tree/master/packages/create-electron) tool to scaffold your project.