Skip to content

Electron 'remote' module is considered harmful #37

Description

@LRode

Describe the bug
Starting in Electron version 10, the electron remote module is disabled by default. You have to manually enable it, and the Electron docs recommend moving away from using it (For many reasons see this article).

As we are using the launchdarkly-electron-client-sdk in an Electron version greater than 10, we had to enable remote module to use it. I was wondering if there are any plans to upgrade the code and move away from the remote module.

To reproduce

  • Import launchdarkly-electron-client-sdk in Electron renderer process, with Electron version 10+.
    (In our case, we are using it in the renderer preload script)
  • Renderer fails to load, and can see error messages that electron remote is undefined

Workaround:

  • Add enableRemoteModule: true to webPreferences of BrowserWindow
  • Or: implement custom IPC methods to communicate from main to renderer and don't use launchdarkly-electron-client-sdk in the renderer.

Expected behavior
Importing launchdarkly-electron-client-sdk without enableRemoteModule: true should work without errors.

Logs
image
image

SDK version
1.6.3

Language version, developer tools
Electron: 13.6.3, Typescript: 4.6.0

OS/platform
macOS 11.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions