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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with electron-better-ipc #3285

Closed
PaulSender opened this issue Aug 8, 2022 · 2 comments
Closed

Compatibility with electron-better-ipc #3285

PaulSender opened this issue Aug 8, 2022 · 2 comments

Comments

@PaulSender
Copy link

Currently, electron-better-ipc doesn't work with the webpack configuration for electron-react-boilderplate.

The following error occurs when trying to make a call from rerender to main as defined in the package's docs:

Module not found: Error: Can't resolve 'fs' in '/Users/paulsender/dev/beacon/electron/node_modules/electron

I tried resolving the error through the following thread:

sindresorhus/electron-better-ipc#36.

A package maintainer for electron-better-ipc said the issue is one with webpack. I followed the "solutions" on this thread and realized everything was already configured according to those solutions.

Since electron-react-boilerplate uses .erbs for it's webpack configs. I'm assuming there must be some additional configuration not documented anywhere to get this type of package to work with .erb webpack configs. If I'm wrong about this assumption a point in the right direction would be greatly appreciated.

@amilajack
Copy link
Member

You could fix this by adding this to your webpack main and renderer prod and dev configs:

// renderer webpack configs
new webpack.DefinePlugin({
  'process.type': JSON.stringify('renderer'),
});

// main webpack configs
new webpack.DefinePlugin({
  'process.type': JSON.stringify('main'),
});

@amilajack
Copy link
Member

Additionally, electron-better-ipc imports electron in the renderer process, which isn't allowed when nodeIntegration is false.

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

No branches or pull requests

2 participants