diego3g/electron-typescript-react

child_process issue in packaged output

Closed this issue · 1 comments

In App.tsx
`
const childProcess = require('child_process')
const App = () => {

childProcess.exec('npm -v', (error, stdout, stderr) => {
if (error) {
alert('Error')
return
}
alert(stdout.toString())
})

return (
<>

</>
)
}

`

Working fine in Development mode.
But getting 'Error' alert while running the packaged output ?

With the new Electron releases we cannot call Node.js modules directly from renderer process anymore, now you have to use the bridge file to communicate between renderer and main process.

I did a full refactor of the structure to include this option, take a look at 6acba3b.