while using this code getting following issue
App threw an error during load
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\project\node_modules\electron-is-dev\index.js from D:\ecosail\index.js not supported
here is my code of electron index.js
const { app, BrowserWindow, Menu } = require('electron');
const path = require('path');
const isDev = require('electron-is-dev');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true, // Consider using contextIsolation and preload instead
webSecurity: false // to disable web security (consider enabling for production)
}
});
if (isDev) {
console.log('Running in development');
} else {
console.log('Running in production');
}
win.loadURL("http://localhost:3000/");
//win.webContents.openDevTools();
}
while using this code getting following issue App threw an error during load Error [ERR_REQUIRE_ESM]: require() of ES Module D:\project\node_modules\electron-is-dev\index.js from D:\ecosail\index.js not supported
here is my code of electron index.js const { app, BrowserWindow, Menu } = require('electron'); const path = require('path'); const isDev = require('electron-is-dev');
function createWindow() { const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true, // Consider using contextIsolation and preload instead webSecurity: false // to disable web security (consider enabling for production) } });
if (isDev) { console.log('Running in development'); } else { console.log('Running in production'); } win.loadURL("http://localhost:3000/"); //win.webContents.openDevTools(); }
app.on('ready', () => { const menu = Menu.buildFromTemplate([]); Menu.setApplicationMenu(menu); createWindow(); });
app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit(); } });
app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) { createWindow(); } });