Closed steveoh closed 3 years ago
inside my main.js
it appear there is access to fs
. Learning more about electron might be my issue.
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const Store = require('electron-store');
const store = new Store();
ipcMain.handle('loadContent', (e) => {
return store.get('config.key');
});
ipcMain.on('saveContent', (e, content) => {
store.set('config.key', content);
});
This works.
@steveoh were you able to install it? curious, same problem. :)
Yes, our issue was with the misunderstanding of where the node code was allowed to run. Using the ipc bridge to a main process allows this to work properly.
I have the same issue and I'm not sure how @steveoh solved it. Do i need to have node integration enabled? I still get the error that I need the fs module, if I set fs; false in the fallback then I get another error fs.existsFileSync doesnt exist.
I also tried to use a boiler template: https://github.com/electron-react-boilerplate/electron-react-boilerplate And impossible to make this library work with it :(
So I gave up and went for a custom implementation, but would love to replace my custom code with this package if someone finds a solution.
Because of webpack 5 removing polyfills this library no longer works with the electron forge starter project.
I have been able to polyfill everything except for
fs
via theresolve.fallback
webpack config.fs
is imported fromconf
,electron
, andpath-exists
.I've tried the
resolve.preferRelative: true,
but it gives the same issue without the did you mean text.I'm not quite sure how to polyfill
fs
and if I should have to. What thoughts do folks have on this?This stack overflow question has some answers about using
window.require
but I'm not sure how that can be possible with this projects dependencies.Thanks in advance!
refs #191