Skip to content

Support wasm32-u-u on web via patching Cargo.toml? #674

@dhardy

Description

@dhardy

As I outlined here, we could support wasm32-unknown-unknown on web via patching Cargo.toml:

We publish getrandom-js with feature all-targets:

  • For wasm32-unknown-unknown, this will assume a web (JS) target.
  • For other targets without feature all-targets, this will compile_error!.
  • For other targets with feature all-targets, this will depend on and use getrandom.

Users may enable this platform for getrandom by patching Cargo.toml as follows:

[patch.crates-io.getrandom]
version = "0.3"
package = "getrandom-wasm-js"

I think this approach will work, but it's untested. It does not support selection via cfg (e.g. env var) however.

This does not prevent us also supporting wasm32-u-u on web with the current solution (specifying getrandom_backend='wasm_js').

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions