Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the dev tools not show up on screen by default in Electron?

I am using electron-react-boilerplate to create an Electron-React app. The dev tools show up on the screen by default. How can I make the dev tools only appear when I ask for them and not show up on launch?

Also, there are no errors shown in the console, so the dev tools are not showing up because there's an error.

enter image description here

like image 457
Kapil Gupta Avatar asked Oct 28 '16 12:10

Kapil Gupta


People also ask

How do I turn off dev tools in Electron?

Disable developer tools in productionThe key-combination CTRL + SHIFT + I (or ALT + CMD + I on Mac) will open the dev tools and enable inspection of the application. It will even enable some degree of modification.

How do electrons show developer tools?

Since the renderer process is the one being executed in our browser window, we can use the Chrome Devtools to debug it. To open DevTools, use the shortcut "Ctrl+Shift+I" or the <F12> key.


1 Answers

Just comment or remove this line of code in main.js file (setting devTools to false) this.mainWindow.openDevTools(); (or) Add the following code to

     mainWindow = new BrowserWindow({       width: 1024,      height: 768,      webPreferences: {       devTools: false       }    }); 

(or) change the package.json build to npm run build && build --win --x64 (or) again install npm

like image 110
Atchutha rama reddy Karri Avatar answered Oct 06 '22 06:10

Atchutha rama reddy Karri