electron require is not defined 报错解决
Electron 12 及更高版本,设置了nodeIntegration: true,渲染进程仍然会报错误:require is not defined
这时需要在webPreferences中添加:contextIsolation: false
完整如下:
webPreferences:{ nodeIntegration:true,contextIsolation: false}
* nodeIntegration:控制是否集成node * contextIsolation:控制上下文隔离
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
