create-wasm-app icon indicating copy to clipboard operation
create-wasm-app copied to clipboard

Electron bundle

Open roccomuso opened this issue 6 years ago • 0 comments

I have a bundle like this that is not electron-ready apparently:

const path = require('path').join(__dirname, 'my_project_bg.wasm');
const bytes = require('fs').readFileSync(path);
let imports = {};
imports['./my_project'] = require('./my_project');

const wasmModule = new WebAssembly.Module(bytes);
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
module.exports = wasmInstance.exports;

Trying to run it in Electron I get this error:

WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread.

Do someone used an app created with create-wasm-app in electron?

roccomuso avatar Feb 22 '19 19:02 roccomuso