Skip to content

Electron Node Red no longer logs to console #20

@geoffatblacktusk

Description

@geoffatblacktusk

After chasing down a blank console issue, I loaded the dev tools and found that 'require' is not being recognised in the console.htm.
On further investigation I found that as well as nodeIntegration:true, there was a breaking change in Electron 12, which now requires contextIsolation:false if the require is to be included in the renderer process rather than main.js.
(see https://www.electronjs.org/docs/latest/breaking-changes#default-changed-contextisolation-defaults-to-true).
The following change should be made to main.js
webPreferences: {
//gma - node integration required for ipcRenderer in html
//gma - Breaking Change in Electron12, contextIsolation defaults to true
nodeIntegration: true,
contextIsolation: false,
nativeWindowOpen: true
}
Also, note that url.format is now deprecated, so it is recommended to use path.join;
conWindow.loadURL(path.join(__dirname, urlconsole));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions