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

Improve documentation for Electron 20 sandboxing defaults #138

Open
Nashorn opened this issue Sep 16, 2022 · 1 comment
Open

Improve documentation for Electron 20 sandboxing defaults #138

Nashorn opened this issue Sep 16, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Nashorn
Copy link

Nashorn commented Sep 16, 2022

After upgrading to electron 20.0.0, the render process is now throwing this error:
node:electron/js2c/sandbox_bundle:93 Error: module not found: ./node_modules/@electron/remote
at preloadRequire (node:electron/js2c/sandbox_bundle:93:1386)
at :3:14
at runPreloadScript (node:electron/js2c/sandbox_bundle:93:2213)
at Object. (node:electron/js2c/sandbox_bundle:93:2480)
at ./lib/sandboxed_renderer/init.ts (node:electron/js2c/sandbox_bundle:93:2636)
at webpack_require (node:electron/js2c/sandbox_bundle:1:170)
at node:electron/js2c/sandbox_bundle:1:1242
at _electron_webpack_init (node:electron/js2c/sandbox_bundle:1:1320)
at node:electron/js2c/sandbox_bundle:160:455

@erickzhao
Copy link
Member

Hey @Nashorn

There's already a note for this in the README but I think it could be more clear since renderers are sandboxed by default in Electron 20:

Note: Since this is requiring a module through npm rather than a built-in module, if you're using remote from a sandboxed process, you'll need to configure your bundler appropriately to package the code of @electron/remote in the preload script. Of course, using @electron/remote makes the sandbox much less effective.

As a workaround, turn sandbox:false in the BrowserWindow constructor webPreferences

const win = new BrowserWindow({
  webPreferences: {
    sandbox: false
  }
})

@erickzhao erickzhao changed the title Error: module not found: ./node_modules/@electron/remote Improve documentation for Electron 20 sandboxing defaults Sep 21, 2022
@erickzhao erickzhao self-assigned this Sep 21, 2022
@erickzhao erickzhao added the documentation Improvements or additions to documentation label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants