Open RossAddinall opened 6 years ago
when I do this, I get a new error: window.require is not a function
@KlaussMC I think Webpack is causing some weirdness here, might also be related to nodeIntegration: false
. I haven't done Electron stuff for a while now so sorry for not being much help 😢
I'm still having the same error whenever I write
import { electronEnhancer } from 'redux-electron-store';
yes when you try to require('electron');
with nodeIntegration: false
it dsplay this strange error.
Just want to re-surface this thread. Did anyone end up finding a solution to this issue?
Setting nodeIntegration: true
didn't fix it and I also got window.require is not a function
. I use electron 10.0.0 if it helps.
Hi,
I am getting an error: Uncaught TypeError: fs.existsSync is not a function
This link: provides a workaround to the problem. To be entirely honest I don't really understand the cause of the problem, but it certainly works for me.
I am using Electron, React, Redux and Webpack.
The full trace that I get is this:
The line of code that I wrote (renderer_store.js:38) is:
let renderer_store = createStore(rootReducer, main_store.getState(), enhancer);
which in turn leads (eventually) to electronRendererEnhancer.js:82:
var _require = require('electron');
which I presume is derived from renderer-enhancer.js:
const { ipcRenderer, remote } = require('electron');
If I change electronRendererEnhancer.js:82 to be:
var _require = window.require('electron');
the error goes away.As I said at the top I don't really understand the root cause of this. If it is appropriate, then perhaps renderer-enhancer.js could be updated to be:
const { ipcRenderer, remote } = window.require('electron');
but that may have other consequences I can't see.If the change is not possible, then hopefully this issue will help others.