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

instant needs wasm-bindgen outside of dev #27

Closed
zperk13 opened this issue Jun 21, 2022 · 1 comment · Fixed by #60
Closed

instant needs wasm-bindgen outside of dev #27

zperk13 opened this issue Jun 21, 2022 · 1 comment · Fixed by #60

Comments

@zperk13
Copy link

zperk13 commented Jun 21, 2022

In Cargo.toml, you have these lines of "code"

`[target.'cfg(target_arch = "wasm32")'.dependencies]
instant = "0.1"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
instant = { version = "0.1", features = ["wasm-bindgen"] }
wasm-bindgen-test = "0.3"
getrandom = { version = "0.2", features = ["js"] }`

If I'm using wasm-bingen and fastrand, and I'm not using a dev-dependcy profile, the compiled wasm simply won't work (more info here).

I fixed it by adding instant = {version="*", features=["wasm-bindgen"]} to my Cargo.toml file, but if it's possible, I think your Cargo.toml file should be modified in a way so I don't have to do this

@taiki-e
Copy link
Collaborator

taiki-e commented Jul 2, 2022

This is semi-intentional because we cannot deduce which JavaScript interface is in use from the target name alone (see also getrandom's doc).

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

Successfully merging a pull request may close this issue.

2 participants