Electron 渲染进程中解决require is not defined的问题
时间:2020-07-06 14:30:38
收藏:0
阅读:243
再Electron 5.0之后,如果需要在渲染进程中使用Node.js的模块,需要手动将创建窗口时候的nodeIntegration这一选项开启,这样就能避免报错了。
mainWindow = new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
})
// nodeIntegration: true 加上这一句 就可以了 5.0以后默认是false
作者:艾孜尔江
原文:https://www.cnblogs.com/ezhar/p/13254332.html
评论(0)