Closed ChugunovRoman closed 1 year ago
same issue!!
alternative https://www.npmjs.com/package/electron-store
$ npm install electron-store
It works!
you can use https://github.com/linonetwo/electron-ipc-cat to proxy the request to your preference services, just like how I'm doing in https://github.com/tiddly-gittly/TiddlyGit-Desktop
Hope my code example and npm package helps.
You can fix it temporarily by provide a custom Electron instance;
const getElectron = () => {
const electron = window.require('electron');
// @ts-ignore
electron.remote = electron.remote || window.require('@electron/remote');
return electron;
}
const settings = window.require('electron-settings');
settings.configure({
electron: getElectron(),
})
For those still in v.3.#
we can workaround this by:
const remote = require("@electron/remote");
settings.setPath(path.join(remote.app.getPath("userData"), "Settings"));
This will still point to the default file but because it's using a custom path, electron-settings
won't try to use remote
from the electron
dependency.
@ChugunovRoman I am assuming you are trying to use electron-settings in the Renderer (you should provide more information in your bug reports). If you want to use the newer versions of Electron and have access to higher level APIs like remote, you need to make use of the context isolation feature to create a limited API that can be called from the Renderer. You shouldn't try to get around the security changes Electron has implemented. Yes the context isolation is a pain, but it is in the app user's best interest of your app.
Current version (
4.0.2
) of Electron-settings doesn't work with new version Electron. I use Electronv14.1.1
I got a error in render process: