Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for crossplatform loading of .wasm files #5342

Closed
zandaqo opened this issue Jun 26, 2017 · 3 comments
Closed

Workaround for crossplatform loading of .wasm files #5342

zandaqo opened this issue Jun 26, 2017 · 3 comments

Comments

@zandaqo
Copy link

zandaqo commented Jun 26, 2017

Hi guys,

I'm playing with compiling C++ libraries to WASM modules over here, it's been great so far, but the issue with loading .wasm from a different directory kills any attempt of making an npm package that can seamlessly work in both node and browsers. So I have two questions here:

  1. Is there some accepted workaround to fix this?
  2. How can I manually load the .wasm file and feed it to the module? Just setting Module.wasmBinary doesn't seem to work:
const fs = require('fs');
const wasm = require('./wasm.js');
wasm.wasmBinary = fs.readFileSync('./wasm.wasm');
@zandaqo
Copy link
Author

zandaqo commented Jun 26, 2017

Also, inlining wasm would probably be the simplest solution, can emcc do it?

@kripken
Copy link
Member

kripken commented Jun 26, 2017

Yeah, this is an annoying problem. There is a PR open for embedding it, #5296, which is one workaround. More discussion in #5104.

@zandaqo
Copy link
Author

zandaqo commented Jun 27, 2017

@kripken I guess I better wait for embedding then. Thank you, I'll close this issue in favor of #5104 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants