dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Support `wasm32-unknown-emscripten` Target

Open mattangus opened this issue 1 year ago • 1 comments

Feature Request

I have a dependency that only supports the wasm32-unknown-emscripten target (I think it requires exceptions, but I'm not sure).

Apart from dioxus-logger it seems that the target is compatible with the main parts of the echo system. Namely dioxus, dioxus-web and dioxus-router.

I can compile using cargo cargo build --target wasm32-unknown-emscripten, but it doesn't seem to work with dx serve.

Running the following command:

dx serve --target wasm32-unknown-emscripten

results in the the following in the target directory:

CACHEDIR.TAG  debug  wasm32-unknown-unknown

Implement Suggestion

The target flag doesn't seem to propagate properly to cargo build command.

After a quick search, it seems this hard coded target is the cause

https://github.com/DioxusLabs/dioxus/blob/b97e607aca0bd8a12971fcf403908addf9a45dd7/packages/cli/src/builder/cargo.rs#L48-L51

mattangus avatar Aug 09 '24 08:08 mattangus

It seems like wasm-bindgen doesn't support emscripten, so this might be a dead end for now https://github.com/rustwasm/wasm-bindgen/issues/2722.

mattangus avatar Aug 11 '24 00:08 mattangus

It seems like wasm-bindgen doesn't support emscripten, so this might be a dead end for now rustwasm/wasm-bindgen#2722.

Yeah looks like wasm-bindgen doesn't yet have a plan to implement this. I'll close this for now until there's more progress on their end :disappointed:

matthunz avatar Aug 28 '24 21:08 matthunz