electron-settings: Cannot read property 'app' of undefined
Electron version: 10.0.0 Electron-settings version: 4.0.2 Platform: Windows 10
This function of the source depends on the “remote” module which is deprecated. In the new versions of the Electron it will be removed afaik.
* Returns the Electron app. The app may need be accessed
* via `Remote` depending on whether this code is running
* in the main or renderer process.
*
* @returns The Electron app.
* @internal
*/
function getElectronApp() {
var _a;
var e = getElectron();
var app = (_a = e.app) !== null && _a !== void 0 ? _a : e.remote.app;
return app;
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
I tested it in the past and it did not work back then. Got to try it again since you asked and I spotted an error on my end.
The enableRemoteModule: true needs to be in webPreferences: {}
Was:
new BrowserWindow({ enableRemoteModule: true });
Needed to be:
new BrowserWindow({ webPreferences: { enableRemoteModule: true }});
Now it works perfectly. So unless it’s the same for you, it seems to be working with the flag properly set.
@ThibaultJousse thanks for bumping this. It’s always been in the back of my mind, just haven’t gotten around to it, for really no good reason 😃 I’ll take care of this right now
@nathanbuchar, no no no no, this is not a solution, this is a crutch. well, i made a fork to avoid using the ‘remote’ module. it’s kinda raw, but i still could make a pull request, would you like me to ?