Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to debug the main process code of Electron application on VSCode

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

The knowledge of this article "how to debug the main process code of Electron application on VSCode" is not understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to debug the main process code of Electron application on VSCode" article.

Build an environment

The project used in this article is electron-quick-start.

$git clone https://github.com/electron/electron-quick-start$ cd. / electron-quick-start$ npm install

After the above steps, the basic Electron application development environment is built. View package.json:

{"name": "electron-quick-start", "version": "1.0.0", "description": "A minimal Electron application", "main": "main.js", "scripts": {"start": "electron."}, "repository": "https://github.com/electron/electron-quick-start"," keywords ": [" Electron "," quick "," start "," tutorial " "demo"], "author": "GitHub", "license": "CC0-1.0"," devDependencies ": {" electron ":" 16.0.6 "}}

We can run npm run start on the terminal to view the running result:

As you can see, the construction of the environment has been completed! Next, let's move on to the development and debugging process.

Debug configuration

To open it using VSCode, do the following:

Generate the lauch.json file for the following configuration:

{/ / use IntelliSense to learn about the relevant properties. / / hover to see a description of an existing property. / / for more information Please visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [{"type": "pwa-node", "request": "launch", "name": "Launch Program", "skipFiles": ["/ *"] "program": "${workspaceFolder} / main.js"]}

We modify the configuration as follows:

{"version": "0.2.0", "configurations": [{"name": "Debug Main Process", "type": "node", "request": "launch", "cwd": "${workspaceFolder}", "runtimeExecutable": "${workspaceFolder} / node_modules/.bin/electron" "windows": {"runtimeExecutable": "${workspaceFolder} / node_modules/.bin/electron.cmd"}, "args": [. / main.js " / / main file path]}]} above is the content of the article on "how to debug the main process code of Electron applications on VSCode" I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 282

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report