Last active
September 18, 2021 15:30
-
-
Save sfengyuan/696c8234ac97d99f4b1c2ecfd3252e9d to your computer and use it in GitHub Desktop.
Install chrome extension devtools to Electron projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'; | |
... | |
app.on('ready', () => { | |
const mainWindow = createWindow() | |
if (process.env.mode === 'development') { | |
installExtension(VUEJS_DEVTOOLS) | |
.then((name) => console.log('installed ', name)) | |
.catch((err) => console.log('An error occurred: ', err)); | |
const ses = mainWindow.webContents.session | |
console.log('renderer storage path: ', ses.getStoragePath()) | |
mainWindow.webContents.on('did-frame-finish-load', () => { | |
mainWindow.webContents.once('devtools-opened', () => { | |
mainWindow.focus() | |
}) | |
mainWindow.webContents.openDevTools() | |
}) | |
} | |
}) | |
// in the renderer storage path, open the extension manifest.json, delete all the unrecognized fields. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment