-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Currently is difficult to load a wasm file from another directory. When installing the linuxduino npm module there is an error when requiring linuxduino as it files to load wasm. See (emscripten-core/emscripten#5342). Currently there is no an actual solution from emscripten.
Solution/Workaround
Knowing that this code will only run on linux the following code in the linuxduino.js output was modified:
var wasmBinaryFile = Module['wasmBinaryFile'] || 'serial.wasm');to this:
if (typeof window === 'object') {
// If running Electron+Node
var wasmBinaryFile = Module['wasmBinaryFile'] || 'serial.wasm';
} else {
// If running Node
var wasmBinaryFile = Module['wasmBinaryFile'] || (__dirname+'/serial.wasm');
} This works perfect for running linuxduino with node. But when using Electron with the linuxduino code hosted from a server you need to include the linuxduino.wasm file next to the file that does the require('linuxduino') in the server files.
TODO: Find a better solution or wait for emscripten to solve this.
Metadata
Metadata
Assignees
Labels
No labels