Skip to content

Supporting asm.js and wasm optimally with a single JS Module #5047

@dschuff

Description

@dschuff

Currently Chrome and Firefox are rolling out wasm MVP support, but it will be some months before other browsers go through their release train and get wasm out to users. Until wasm is ubiquitous emscripten users will probably want to build both asm.js and wasm versions of their code. There are a couple of possible ways to do this today.

  1. Use the native-wasm,asm.js binaryen method. This isn't well tested and in any case won't really work now because wasm module loading needs to be asynchronous.
  2. Do 2 separate builds (and generate 2 different sets of JS glue) and load one or the other based on feature testing.

Would it be possible to support both synchronous and async loading from the same generated JS glue? If so, would there be significant drawbacks (e.g. code size?). Otherwise, what can we do to make option 2 easier?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions