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

posted @ 2022-01-19 17:21  枫叶丶|  阅读(266)  评论(0编辑  收藏  举报