DEV Community

Discussion on: Creating a text editor in Electron: part 1 - Reading files

Collapse
 
paulgeorge92 profile image
Paul George

Files are not showing in the left pane. When I open in chrome, it shows as error require is not defined. I added reference to require.js still not working. I ran the app using node. Still not able to see the files

Collapse
 
andriybaran profile image
andriy-baran

For electron version >= 5 in main.js

mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      nodeIntegration: true // <--- Add this
    }
  })
Enter fullscreen mode Exit fullscreen mode