相关疑难解决方法(0)

Electron v14 TypeScript 类型定义中缺少enableRemoteModule

我已经升级到 Electron 14,重构了我的项目以适应“已删除:远程模块”重大更改,但由于以下 TypeScript 错误,我无法编译它:

Type '{ plugins: true; nodeIntegration: true; contextIsolation: false; enableRemoteModule: true; backgroundThrottling: false; webSecurity: false; }' is not assignable to type 'WebPreferences'.

Object literal may only specify known properties, and 'enableRemoteModule' does not exist in type 'WebPreferences'.ts(2322)

electron.d.ts(12612, 5): The expected type comes from property 'webPreferences' which is declared here on type 'BrowserWindowConstructorOptions'
Run Code Online (Sandbox Code Playgroud)

受影响的代码:

const window = new electron.BrowserWindow({
    // ...
    webPreferences: { 
      plugins: true, 
      nodeIntegration: true, 
      contextIsolation: false,
      enableRemoteModule: true, 
      backgroundThrottling: false,
      webSecurity: …
Run Code Online (Sandbox Code Playgroud)

typescript electron

20
推荐指数
1
解决办法
1万
查看次数

标签 统计

electron ×1

typescript ×1