I’m trying to use electron-store package to store values in a vue + electron application.
I’ve followed the examples given by the author here: https://www.npmjs.com/package/electron-store.
But im getting error when running the app, whenever. store seems to be undefined.
electron main.js
import Store from "electron-store";
const store = new Store();
ipcMain.on("electronStore", (event, args) => {
if (args.commandStr === "getElectronStore") {
console.log(store);
console.log(new Store())
console.log(store.get(args.key));
mainWindow.webContents.send("electronStore", store.get(args.key));
}
else if (args.commandStr === "setElectronStore") {
store.set(args.key, args.value);
}
});
my app is modular, so ive made sure all my packages are imported using ESM format:
package.json:
"type": "module",
any idea whats wrong with this? how do i initialize electron store properly ?