已编译的 Electron App 中的调试器
Debugger in compiled Electron App
我需要在已编译的 Windows 应用程序(Electron App)中使用 chrome 调试器
我的main.js:
const electron = require('electron')
require('electron-debug')({showDevTools: true});
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
let mainWindow
function createWindow () {
mainWindow = new BrowserWindow({width: 800, height: 800})
mainWindow.loadURL('https://camservices.prointernet.com/client.html');
mainWindow.on('closed', function () {
mainWindow = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})
但是调试器不会出现在已编译的应用程序中。
根据 documentation,您可以通过添加 enabled
属性.
强制它出现在生产应用程序中
require('electron-debug')({showDevTools: true, enabled: true});
我需要在已编译的 Windows 应用程序(Electron App)中使用 chrome 调试器
我的main.js:
const electron = require('electron')
require('electron-debug')({showDevTools: true});
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
let mainWindow
function createWindow () {
mainWindow = new BrowserWindow({width: 800, height: 800})
mainWindow.loadURL('https://camservices.prointernet.com/client.html');
mainWindow.on('closed', function () {
mainWindow = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})
但是调试器不会出现在已编译的应用程序中。
根据 documentation,您可以通过添加 enabled
属性.
require('electron-debug')({showDevTools: true, enabled: true});