Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when building outside renderer process #18

Closed
neist opened this issue Aug 15, 2019 · 3 comments 路 Fixed by #21
Closed

Issue when building outside renderer process #18

neist opened this issue Aug 15, 2019 · 3 comments 路 Fixed by #21

Comments

@neist
Copy link

neist commented Aug 15, 2019

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:

const ipc = Object.create(ipcRenderer);

Results in:
Object prototype may only be an Object or null: undefined

This happens because const {ipcRenderer} = electron; is resulting in undefined when running outside the renderer process - for example when building / prerendering 鈽猴笍

Could be the same issue causing #15

@neist
Copy link
Author

neist commented Aug 18, 2019

I'm using Next.js by the way 馃槉 Would you be interested in a pull request?

@neist
Copy link
Author

neist commented Aug 19, 2019

A solution could be:

Renderer

Change this:

const ipc = Object.create(ipcRenderer);

To this:

const ipc = Object.create(ipcRenderer || {});

Main

Change this:

const ipc = Object.create(ipcMain);

To this:

const ipc = Object.create(ipcMain || {});

This allows for pre-rendering / SSR such as Next.js 鈽猴笍

@bkniffler
Copy link

Experiencing the same, would love to have this fixed! @neist suggestion looks reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants