It looks like you re trying to add a regular Chrome extension instead of a Dev Tools extension.
<代码>BrowserWindow.addExtension(path)方法是常规的 Chrome延:
BrowserWindow.addExtension(path)
Adds Chrome extension located at path
, and returns extension s name.
如果延期清单缺失或不完整,该方法也不会返回。
<>说明: 不能在<代码>ready前打电话。 www.un.org/Depts/DGACM/index_french.htm 模块已投入使用。
- https://electronjs.org/docs/api/browser-window#browserwindowaddextensionpath
Conversely, the BrowserWindow.addDevTools Extension(path)
method is for Dev Tools extensions:
BrowserWindow.addDevTools Extension(path)
AddsDevTools extension, 地址:path
, 并注明返回国名。
The extension will be remembered so you only need to call this API once, this API is not for programming use. If you try to add an extension that has already been loaded, this method will not return and instead log a warning to the console.
如果延期清单缺失或不完整,该方法也不会返回。
<>说明: 不能在<代码>ready前打电话。 www.un.org/Depts/DGACM/index_french.htm 模块已投入使用。
<https://electronjs.org/docs/api/browser-window#browserwindowadddevtoolsextensionpath”rel=“noreferer”>https://electronjs.org/docs/api/browser-window#browserwindowadddevtooltensionpath
请注意,在这两种情况下,你都需要等待<代码>ready。 www.un.org/Depts/DGACM/index_french.htm 模块:
const { BrowserWindow, app } = require( electron )
let mainWindow = null
function main() {
BrowserWindow.addExtension( /path/to/extension )
mainWindow = new BrowserWindow()
mainWindow.loadURL( https://google.com )
mainWindow.on( close , event => {
mainWindow = null
})
}
app.on( ready , main)