Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Implementation of "Preload" #83

Open
joserick opened this issue Apr 26, 2021 · 1 comment
Open

Implementation of "Preload" #83

joserick opened this issue Apr 26, 2021 · 1 comment

Comments

@joserick
Copy link

Hi,

I am implementing the security tip from Electron.
https://www.electronjs.org/docs/tutorial/security#2-do-not-enable-nodejs-integration-for-remote-content

But this has no effect, I don't know if it's because vite and electron run independently of each other.

create-window.js

- nodeIntegration: true,
+ preload: path.join(app.getAppPath(), 'preload.js'),

preload.js

const { ipcRenderer } = require('electron')
window.ipcRenderer = ipcRenderer

index.html

  <script>
    alert(window.ipcRenderer) // Return: "undefined"
  </script>

Could you support me with this problem?

@appinteractive
Copy link
Owner

I was thinking about implementing this package to solve that issue:
https://github.com/frankwallis/electron-ipc-proxy or https://github.com/geblanco/electron-router

Would that help in your case? I already spit main and renderer and switched to typescript in the latest iteration, the next step would be to setup a communication channel.

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

No branches or pull requests

2 participants