-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Electon 16 #94
Comments
@MarshallOfSound Electron remote may be a separate module, but as it worked in the previous version of Electron and I can't seem to find any changes regarding breaking changes between Electron 15 => Electron 16, I would assume that it is Electron issue and not Electron Remote issue. |
As stated in https://github.com/electron/remote/blob/main/docs/migration-2.md you now need to call Just tested this with [email protected] and no problems: import { initialize, enable as enableRemote } from "@electron/remote/main";
initialize();
// ...
const win = new BrowserWindow({ ... });
enableRemote(win.webContents); |
Remote main is initialized. I already was on version 15 without any issues, so this change:
Does not apply for moving from 15 to 16? I am still on electron-remote 1. So the migration to electron-remote 2 does not apply either? From what you are telling it seems that I need to migrate from electron-remote 1 to electon-remote 2 if I upgrade from electon 15 to electron 16. If that is so, the issue is documentation. |
If you're on version 1.x of @electron/remote this error should trigger https://github.com/electron/remote/pull/75/files. |
I only got:
So either a different check catches the problem and issues the message I got or the check was not present in my version. My remote version was 1.0.4. |
I received such errors
|
electron v16.x had modify export , @electron/remote need update
|
Electron 16 is completely unusable if using electron remote |
I have the similar problem, it works in Mac and it does not in ubuntu... |
Just tested this with electron@^16.0.5 and it works in Mac: main.js require('@electron/remote/main').initialize()
const mainWindow = new BrowserWindow({
.........
})
require("@electron/remote/main").enable(mainWindow.webContents) renderer.js const { BrowserWindow } = require('@electron/remote')
let win = new BrowserWindow({ width: 1800, height: 1600 })
win.loadURL('https://www.google.com/') |
I encounter the same problem with electron 15.3.5 btw. |
@huyinghuan does it maybe make sense to open a new issue? I think we're all encountering the problem you describe, but the issue description indicates a completely different problem (not initializing the remote module). |
I fixed this by upgrading electron remote version. |
@exander77 do you mean to the latest commit on master? |
@johannesjo No. Read the above discussion. |
Think I found a possible fix for now. Enabling the remote module within renderer doesn't do anything. It seems to only have an effect in main. Calling it within a 'browser-window-created' event should work. app.on('browser-window-created', (_, window) => {
require("@electron/remote/main").enable(window.webContents)
}) |
thanks @panthesingh - your code worked for me for ferdium! |
Same thing for me, thanks @panthesingh, as It seems not possible to "enbale" from a preload file. But do you think it is possible to filter windows not to enable remote on every opened windows? |
@sindbad75 @vraravam 👌 glad it helped! @sindbad75 The main way I can think of would be to filter using some window object property. |
Ok thanks, I will try it like this. |
enableRemoteModule
is set true and remote is initialized in main. Worked fine with Electron 15.The text was updated successfully, but these errors were encountered: