const { app, BrowserWindow } = require("electron/main");
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 1000,
height: 800,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
},
});
const filePath = `build/index.html`;
!app.isPackaged ? mainWindow.loadURL("http://localhost:3000") : mainWindow.loadFile(filePath);
mainWindow.on("closed", () => (mainWindow = null));
}
app.whenReady().then(() => {
createWindow();
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit();
});
app.on("activate", () => {
if (mainWindow === null) {
createWindow();
}
});