wasm-pack
wasm-pack copied to clipboard
[DRAFT] add support for wasm32-unknown-emscripten
This is an early draft PR for the purposes of gathering feedback early. There are also pending changes to wasm-bindgen and Emscripten. This is for issue #1468.
This PR does a few things:
- Removes hard coded references to
wasm32-unknown-unknown, instead reading.cargo/config.tomlto determine what the target triple is. If this file isn't present or a triple isn't specified,wasm32-unknown-unknownis used as the default. - When targeting
-emscripten, run the wasm-bindgen install step before building. This makes sure it's available for Emscripten during link time.
TODOs:
- Change the
-oargument being passed to Emscripten. The default way this is set up passes a full filename ending in.wasm, which causes Emscripten to not even attempt to emit JS. This might need a change to rustc. - Once
-ois taken care of, actually copy the final files topkg. - After wasm-bindgen is installed, ensure Emscripten can find it. Emscripten is currently reading the location from its own config file, but we might want to set up an environment variable or something to make sure it's using the copy installed by wasm-pack.
I'll also note that some of the infrastructure here will be useful for adding wasm64 support per #1464