electron9版本升级到12

记录些升级踩的坑

原因
1. 最近重新跑旧项目https://github.com/qld-cf/electron-react-tpl;运行不起来;一直提示cannot find module 'fs/promises';

A: 升级electron到12版本 ^12.2.3;

2. 页面可以打开了,不过提示“require() is not defined”

A: electron配置webPreferences 添加contextIsolation: false ,参考https://stackoverflow.com/questions/44391448/electron-require-is-not-defined/70738533#70738533

3. 页面提示 Cannot read property 'Menu' of undefined,electron已经开始避免使用remote;所以要开启remote需要再配置下;

A:webPreferences 添加 enableRemoteModule: true 参考:https://github.com/AlexTorresSk/custom-electron-titlebar/issues/101#issuecomment-711041802

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐