在最新的electron12版本中默认没法在渲染进程引入Nodjes模块,
electron12渲染进程如下代码会报错 提示 require is not defined
解决办法: 找到主进程 main.js 配置
const mainWindow = new BrowserWindow({ width: 800, height: 600, webPreferences:{ nodeIntegration:true, contextIsolation:false } });