Электрон зависает, когда в index.html требуется node-opcua , а процесс, называемый Electron Helper, занимает 100% процессора.
Я столкнулся с проблемой в macOS 10.14.2, но друг протестировал в Windows 10, и это сработало.
Из 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>
При запуске простого кода следует просто напечатать объект opcua в консоли.Но полный процесс избиения зависает.