Uncaught ReferenceError: process is not defined
发现许多博客只是添加了
nodeIntegration: true,
仍然会报这个问题
解决办法
# 再添加一行
contextIsolation: false
# 完整代码
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
// nodeIntegration: true
nodeIntegration: true,
contextIsolation: false
}
})