Tips on upgrading to Electron v5


  • Admin

    Hi All,

    If you are building desktop apps then this is for you.

    For upgrading from Electron < 5 to v5+ you will need to edit your src-electron/main-process/main.js at this location:

    mainWindow = new BrowserWindow({
      width: 1000,
      height: 600,
      useContentSize: true,
    
      /**********************
       * ADD THE FOLLOWING: *
       **********************/
      webPreferences: {
        nodeIntegration: true
      }
    })
    

    This is due to a breaking change in Electron v5 which disables node integration by default.

    Enjoy!



  • Thanks! I understand that one will have to change the dependency in the package.json to v5 manually in order to update from v4?


  • Admin

    @bjbk Yes. But please read the Electron release notes first. See if you really want the update and that you fully grasp the changes.



  • @rstoenescu understood. Thank you!


Log in to reply