Improve documentation for Electron 20 sandboxing defaults
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
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
}
})