-
Hi, I'm a beginner and this template already helped me a lot. I have a function that makes an API call to my server in the main.ts and I want to call it in the renderer and return data back to the renderer. Using ipcRenderer gives me this Error: Uncaught ReferenceError: __dirname is not defined I would be grateful if someone can help me with this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Did you remove the ipcRenderer from the Context Bridge in preload.ts by any chance? By default the template comes with a really simple example on how to use ipcMain and ipcRenderer. If you want to use anything from NodeJS, make sure to expose it using the Context Bridge. You can also enable Hope this helps. |
Beta Was this translation helpful? Give feedback.
Did you remove the ipcRenderer from the Context Bridge in preload.ts by any chance? By default the template comes with a really simple example on how to use ipcMain and ipcRenderer.
If you want to use anything from NodeJS, make sure to expose it using the Context Bridge. You can also enable
nodeIntegration
during window construction (not recommended).Hope this helps.