Unable to require or import ipcRenderer
See original GitHub issuePreflight Checklist
- [ ✓ ] I have read the contribution documentation for this project.
- [ ✓ ] I agree to follow the code of conduct that this project follows, as appropriate.
- [ ✓ ] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Issue Details
- Electron Forge Version: 6.0.0-beta.57
- Electron Version: 13.1.4
- Operating System: macOS 11.4 (20F71) Big Sur
- Last Known Working Electron Forge version:: N / A
Expected Behavior
I should be able to import or require ipcRenderer from electron in the Render process.
renderer.ts
const { ipcRenderer } = require('electron')
Actual Behavior
Electron app window opens but crashes on the “⠸ Compiling Renderer Code” step.
Error
⠸ Compiling Renderer Code
An unhandled rejection has occurred inside Forge:
TypeError: Cannot set property 'native_modules/dist/Electron.app/Contents/Frameworks/Mantle.framework/Mantle' of undefined
To Reproduce
Create project with electron forge
npx create-electron-app my-new-app --template=typescript-webpack
Add ipcRenderer to renderer.ts
const { ipcRenderer } = require('electron')
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Unable to require or import ipcRenderer · Issue #2362 - GitHub
I should be able to import or require ipcRenderer from electron in the Render process. Screen Shot 2021-07-07 at 12 15 54 AM....
Read more >How to import the electron ipcRenderer in a react / webpack 2 ...
I fail to import or require ipcRenderer to make communication between main and renderer process possible. My setup can be found here: ...
Read more >How to import ipcRenderer in Renderer Process' Component
You can do so with the following command. const ipcRenderer = window.require('electron').ipcRenderer;. While this is an easy way but it may ...
Read more >can't resolve 'fs' in electron | The AI Search Engine You Control
First of all, I have been using electron.js on my client-side code and the I have been using const { ipcRenderer } =...
Read more >Inter-Process Communication - Electron
Use the ipcMain and ipcRenderer modules to communicate between Electron ... you should be familiar with the idea of using a preload script...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have this same issue, a solution (though I hope it is only temporary) is to do the following:
and to include on renderer code using:
Another way of accessing ipcRenderer using ContextBridge API
https://github.com/electron-userland/electron-forge/issues/2160#issuecomment-889358025