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

WASM Support #3

Open
JacobLinCool opened this issue Aug 20, 2024 · 2 comments
Open

WASM Support #3

JacobLinCool opened this issue Aug 20, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@JacobLinCool
Copy link
Owner

I think it's possible, but I may need to figure out the right feature flags for Tokio and Reqwest.

Some references:

@JacobLinCool JacobLinCool added the enhancement New feature or request label Aug 20, 2024
@JacobLinCool
Copy link
Owner Author

JacobLinCool commented Aug 20, 2024

It doesn't seem that easy to support WASM.

It's simple to find out the flag set. The following seems to be working:

[features]
default = ["tokio/rt-multi-thread"]
wasm = ["getrandom/js", "tokio/time", "tokio/io-util"]

[dependencies]
# others
getrandom = { version = "0.2.15", optional = true }
tokio = { version = "1.38.1", features = ["macros", "rt"] }

Then there are 2 problems to resolve. The first is that reqwest does not support cookies in WASM. (There are some PRs for that: seanmonstar/reqwest#2360, seanmonstar/reqwest#1753, and seanmonstar/reqwest#1449.) The second is that we need to provide a new method to upload files from memory since WASM does not have a filesystem.

@JacobLinCool
Copy link
Owner Author

There is an experimental branch (PR) that can be compiled to the wasm32-unknow-unknown target using cargo build --no-default-features -F wasm --target wasm32-unknown-unknown: #4

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

No branches or pull requests

1 participant