Não consigo abrir uma janela secundaria no electron:
arquivo index.html
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
const { remote } = require('electron')
const main = remote.require('./index.js')
</script>
</head>
<body>
<button onclick="main.newWin()">Novo Jogo</button>
</body>
</html>
arquivo index.js
const electron = require('electron')
const { defaults } = require('pg')
const {app, BrowserWindow, dialog, Menu} = electron
app.on('ready', () => {
win2 = new BrowserWindow({
resizable:false,
frame:true,
show:false,
menu:true,
icon:__dirname + "/logo.png",
webPreferences: {
nodeIntegration : true ,
contextIsolation : false,
enableRemoteModule: true
}
})
win2.loadURL('file://' + __dirname + '/index.html')
win2.maximize()
win2.webContents.openDevTools();
win2.once("ready-to-show",()=>{
win2.show()
})
})
esta saindo o seguinte erro
Uncaught TypeError: Cannot read properties of undefined (reading 'require')
at index.html:11:29
na verdade o require esta dando erro em toda aplicação