require('electron').remote

解决方法地址:https://stackoverflow.com/questions/44391448/electron-require-is-not-defined

app.on('ready', () => {
mainWindow = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
});
});