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 #2166

Closed
genderev opened this issue Jul 29, 2021 · 2 comments
Closed

WASM support #2166

genderev opened this issue Jul 29, 2021 · 2 comments

Comments

@genderev
Copy link

Does rust-libp2p support the wasm32-unknown-unknown target? I tried to compile the ping example with wasm-pack.

I thought the issue would be that the example relies on println! which is not available to the browser, but I actually got this error:

Compiling getrandom v0.2.3

error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support

@fusetim
Copy link

fusetim commented Aug 2, 2021

You just need to add this in your Cargo.toml:
getrandom = { version = "0.2", features = ["js"] }

More info there:

You might need this in the future: #2143

@mxinden
Copy link
Member

mxinden commented Aug 23, 2021

Closing here. Let me know if you need any further help @genderev.

Thanks @fusetim for respoding!

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

No branches or pull requests

3 participants