Electron freezes when node-opcua is required in index.html and a process called Electron Helper takes up 100% of the cpu.
I have encountered the problem on macOS 10.14.2, but a friend tested in Windows 10 and that worked.
From package.json
"devDependencies": {
"electron": "^4.0.4"
},
"dependencies": {
"node-opcua": "^0.5.6"
}
Main.js
const { app, BrowserWindow } = require('electron')
function createWindow () {
// Create the browser window.
win = new BrowserWindow({ width: 800, height: 600 })
// and load the index.html of the app.
win.loadFile('index.html')
win.webContents.openDevTools()
}
app.on('ready', createWindow)
Index.html
<script>
// Does not work
const opcua = require('node-opcua')
console.log(opcua)
// Works
// const fs = require('fs')
// console.log(fs)
</script>
When running the simple code it should just print the opcua object in the console. But the complete electorn process freezes.
Solved it by updating node-opcua to 2.1.9 and electron to 6.0.11