Closed neist closed 5 years ago
I'm using Next.js by the way π Would you be interested in a pull request?
A solution could be:
To this:
const ipc = Object.create(ipcRenderer || {});
Change this: https://github.com/sindresorhus/electron-better-ipc/blob/e78c355db4437da8d0cacca0486aa37fceee7205/source/main.js#L6
To this:
const ipc = Object.create(ipcMain || {});
This allows for pre-rendering / SSR such as Next.js βΊοΈ
Experiencing the same, would love to have this fixed! @neist suggestion looks reasonable.
Hi
First of all, thank you so much for this very convenient IPC wrapper ππ»
I've just integrated it to my project and everything is working flawlessly... almost!
Unfortunately I'm having an issue when building my renderer project.
This line: https://github.com/sindresorhus/electron-better-ipc/blob/e78c355db4437da8d0cacca0486aa37fceee7205/source/renderer.js#L6
Results in:
Object prototype may only be an Object or null: undefined
This happens because
const {ipcRenderer} = electron;
is resulting inundefined
when running outside the renderer process - for example when building / prerendering βΊοΈCould be the same issue causing #15