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

Add features for wasm32-unknown-unknown target #172

Closed
wants to merge 1 commit into from

Conversation

aspect
Copy link
Contributor

@aspect aspect commented Aug 23, 2022

Add new js feature that enables getrandom/js and uuid/js features (uuid already relays it to its own getrandom dependency) in order to be able to build moka for wasm32-unknown-unknown target (i.e. for in-browser execution using builders such as wasm-pack).

getrandom has platform-specific implementations for the random number generator and the crate requires an explicit selection of this feature for wasm32 target when the target OS is unknown, which is the case of the browser targets. If not specified, the build triggers the following error: https://github.com/rust-random/getrandom/blob/master/src/lib.rs#L244. This is just a feature relay that has no effect on the moka codebase.

@aspect
Copy link
Contributor Author

aspect commented Aug 23, 2022

Closing this PR - unable to build our project in release because getrandom is a dev-dependency where dev-dependencies can't be disabled from the crate that is dependent on moka and dev-dependency can not be made optional (cargo disallows). So in release mode, the added feature doesn't see the dev-dependency and errors out.

I will circle back once I am able to come up with the solution, as this seems to be a cargo issue (rust-lang/cargo#1596) in the meantime to advance on our project I am forced to work from the fork with dev-dependencies commented out.

I think it would be solvable by adding "testing" feature and migrating dev-dependencies under [target.'cfg(feature = "testing").dependencies], but not sure. In the meantime closing the PR to avoid this breaking anything.

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

Successfully merging this pull request may close these issues.

1 participant