psperber / redux-persist-electron-storage

Redux persist adapter for electron-store
52 stars 5 forks source link

Error on using storage #14

Open trickyc0d3r opened 4 years ago

trickyc0d3r commented 4 years ago

Hi! I'm facing this error Uncaught TypeError: fs.existsSync is not a function at getElectronPath (index.js:7) at Object.parcelRequire.node_modules/electron/index.js.fs (index.js:18) at newRequire (src.a2b27638.js:47) at localRequire (src.a2b27638.js:53) at Object.parcelRequire.node_modules/electron-store/index.js.path (index.js:3) at newRequire (src.a2b27638.js:47) at localRequire (src.a2b27638.js:53) at Object.parcelRequire.node_modules/redux-persist-electron-storage/lib/index.js.electron-store (index.js:2) at newRequire (src.a2b27638.js:47) at localRequire (src.a2b27638.js:53) while using your library. Have any solutions?

zcmgyu commented 4 years ago

I copied index.js into my project and change the way to import electron-store like this.

const Store = window.require('electron-store');

FarisCode commented 4 years ago

Add nodeIntegration:true in webPreferences.

mainWindow = new BrowserWindow({ title: "sampleApp" width: 300, height: 450, webPreferences: { nodeIntegration: true } });

use window.require('electron-store');

trickyc0d3r commented 4 years ago

Yes, with integration it' working, but what to do if I need to turn all such things off for security reasons.