Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 15442d0

Browse files
committed
Updates docs/en/debugging-production.md
Auto commit by GitBook Editor
1 parent ab9f198 commit 15442d0

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

docs/en/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [Using Pre-Processors](using_pre-processors.md)
1616
* [Using Static Assets](using-static-assets.md)
1717
* [Read & Write Local Files](savingreading-local-files.md)
18+
* [Debugging](debugging-production.md)
1819
* [Building Your App](building_your_app.md)
1920
* [Using electron-packager](using-electron-packager.md)
2021
* [Using electron-builder](using-electron-builder.md)

docs/en/debugging-production.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Debugging
2+
3+
### Main Process
4+
5+
When running your application in development you may have noticed a message from the `main` process mentioning a remote debugger. Ever since the release of `electron@^1.7.2`, remote debugging over the Inspect API was introduced and can be easily accessed by opening the provided link with Google Chrome or through another debugger that can remotely attach to the process using the default port of 5858, such as Visual Studio Code.
6+
7+
```bash
8+
┏ Electron -------------------
9+
10+
Debugger listening on port 5858.
11+
Warning: This is an experimental feature and could change at any time.
12+
To start debugging, open the following URL in Chrome:
13+
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5858/22271e96-df65-4bab-9207-da8c71117641
14+
15+
┗ ----------------------------
16+
```
17+
18+
### Production Builds
19+
20+
###### Notice
21+
22+
Although it is possible to debug your application in production, please do know that production code is minified and highly unreadable compared to what you find during development.
23+
24+
##### `renderer` Process
25+
26+
There isn't much of a big difference here than it is in development. You can simply invoke the dev tools using the [`BrowserWindow` APIs](https://electron.atom.io/docs/api/web-contents/#contentsopendevtoolsoptions). Using the initial electron-vue setup, you can add the following snippet of code inside `src/main/index.js` , just after the `new BrowserWindow` construction, to force the dev tools to open on launch.
27+
28+
```js
29+
mainWindow.webContents.openDevTools()
30+
```
31+
32+
##### `main` Process
33+
34+
Similar to what is mentioned above, you can also attach an external debugger to the `main `process to remotely debug your application. In order to activate the debugger in production you can add the follow snippet after the `app` import inside `src/main/index.js`. Then you can navigate Google Chrome to `chrome://inspect` and get connected.
35+
36+
```js
37+
app.commandLine.appendSwitch('inspect', '5858')
38+
```
39+
40+
41+

0 commit comments

Comments
 (0)