前言
因为要用到新版本的一些API,所以进行了electron版本的升级,项目基于electron-vue-template进行开发;
内容
安装最新长期维护版本的electron
代码语言:javascript复制npm install --save electron@15.3.0
我当时直接修改了package.json中版本的信息,执行了npm i electron的命令,哈哈哈哈
Browserslist: caniuse-lite is outdated
代码语言:javascript复制Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Could not detect abi for version 15.3.0 and runtime electron
代码语言:javascript复制Could not detect abi for version 15.3.0 and runtime electron. Updating "node-abi" might help solve this issue if it is a new release of electron
npm install node-abi
process is not defined | module is not defined
代码语言:javascript复制 mainWindow = new BrowserWindow({
......
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
.....
}
})
https://www.electronjs.org/zh/docs/latest/api/context-bridge#isolated-world
An object could not be cloned
渲染进程中的IPC封装有问题,按文档修改后即可
https://www.electronjs.org/zh/docs/latest/api/ipc-main#ipcmainonchannel-listener