tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.66k stars 2.54k forks source link

Rust tauri_api crate cannot build for WASM #813

Closed leeola closed 3 years ago

leeola commented 4 years ago

Describe the bug When attempting to build tauri_api for a WASM target, the build fails. Specifically:

thread 'main' panicked at 'unsupported target', /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-dialog-sys-0.1.0/build.rs:35:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: In file included from bzip2-1.0.8/blocksort.c:22:
warning: bzip2-1.0.8/bzlib_private.h:25:10: fatal error: 'stdlib.h' file not found
warning: #include <stdlib.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.

Expected behavior I expect a Rust API to be able to run from WASM and communicate to the Tauri backend, for things like setting window titles, window visibility, etc.

Platform and Versions (please complete the following information):

OS: OSX (10.14) Node: 14.5.0 NPM: 6.14.6 Yarn: 1.22.4 Rustc: rustc 1.46.0-nightly (67100f61e 2020-06-24) Target: WASM

leeola commented 4 years ago

As a fallback, i plan on using the web-sys crate to communicate with the window.__TAURI__ object.

seanybaggins commented 4 years ago

I am having the same issue. It would be nice if there was a wasm API. This would make it easier to integrate with front end rust frameworks such as yew and seed.

nklayman commented 3 years ago

The core team has decided that we won't be implementing this anytime soon do to the difficulty of maintaining two backends for the API, we have a lot of other work that is much higher priority.