Hello fellow developers,
I'm developing the Bluetooth Low Energy (BLE) app with my own functions. Now I would like to pack it as a standalone Electron App, which can be started without running the nRF Connect Launcher app first. I have created the boilerplate for Electron to recognize the BLE App. I have created a index.html page to host the dist/bundle.js, a electron.js file to host Electron, then run electron using the terminal script "
".
This is to build the app using nrfconnect script, then run with electron.
After firing up electron, I encountered this error:
[1] App threw an error during load [1] ReferenceError: window is not defined [1] at Object.<anonymous> (E:\MovX\ble-modified\dist\bundle.js:1:856) [1] at Module._compile (internal/modules/cjs/loader.js:1145:30) [1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1166:10) [1] at Module.load (internal/modules/cjs/loader.js:981:32) [1] at Module._load (internal/modules/cjs/loader.js:881:14) [1] at Function.Module._load (electron/js2c/asar.js:769:28) [1] at loadApplicationPackage (E:\MovX\ble-modified\node_modules\electron\dist\resources\default_app.asar\main.js:109:16) [1] at Object.<anonymous> (E:\MovX\ble-modified\node_modules\electron\dist\resources\default_app.asar\main.js:155:9) [1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1166:10)
The error points to bundle.js file, which makes me wonder if this has to do with how the side apps are run. I'm thinking maybe there must be nRF Connect Launcher backend running first, and then to host the side app (the BLE App). If that's the case, is there a way to bundle the connect app into the side app so that the side app can run as standalone?
Thank you very much.