Skip to content
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

Replace remote usage with @electron/remote #1096

Closed
wants to merge 2 commits into from

Conversation

timothyis
Copy link
Member

@timothyis timothyis commented Feb 18, 2022

This pull request replaces all usage of the remote module – built in to Electron before v14 – with the new @electron/remote module.

I have tested this, but I'm not sure if I've missed any edge-cases.

Note: We should work on replacing all usage of this module with other methods, such as using ipc instead.

Closes #1089.

@sindresorhus
Copy link
Member

From the migration guide:

Note: In electron >= 14.0.0, you must use the new enable API to enable the remote module for each desired WebContents separately: require("@electron/remote/main").enable(webContents).

@timothyis
Copy link
Member Author

@sindresorhus I haven't upgraded Electron first, I was going to do that in a separate PR in case more changes were required for the upgrade and this PR got too big. I think in this case, that line of code requires Electron 14+ because it breaks the app when used.

@timothyis
Copy link
Member Author

Scratch that, the issue is that electron-util also uses remote, and removing the config for webPreferences breaks the module: sindresorhus/electron-util#36

@timothyis timothyis marked this pull request as draft February 21, 2022 10:21
@cgarrovillo
Copy link

How big of a change would it be to move away from electron-util?

@timothyis
Copy link
Member Author

That's what I'm working on instead now @cgarrovillo. I've updated Electron locally so I've been removing it piece by piece. However, Electron's DX has changed substantially since I last touched this codebase so it's an interesting task. I'll push what I have soon since it renders the app. There's just a few broken things left.

@cgarrovillo
Copy link

Awesome. I'll be taking a look at the Kap codebase this weekend too so I'll see if I can help out in any way.

@timothyis
Copy link
Member Author

Closing this to hopefully take a fresh look. I overextended in this PR and ended up trying to do too many things (especially in my local code.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to @electron/remote
3 participants