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

Update ahash to fix compilation issue on nightly #672

Merged
merged 3 commits into from Feb 10, 2024

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Feb 6, 2024

The ahash crate has stopped compiling on nightly since today (tkaitchuck/aHash#200). This broke many crates, including this one, and in turn also a part of the Rust compiler benchmark suite, which uses this crate as one of its runtime benchmarks :)

A newer version of ahash (0.8.7) is needed to fix the compilation issue. This PR updates the ahash dependency to fix the compilation of this crate on nightly:

$ cargo +nightly build --no-default-features --features grid,nodejs

However, it still won't work with default features, since parcel_sourcemap would also need to be updated.

@kornelski
Copy link

kornelski commented Feb 6, 2024

grass_compiler has updated its ahash connorskees/grass#89

@kornelski
Copy link

@devongovett It'd be great to merge this. The grass_compiler dependency has upgraded ahash already.

@devongovett
Copy link
Member

Looks like the bump has broken the wasm build due to getrandom not being available. I'll need to look into what changed in more detail.

@mischnic
Copy link
Member

mischnic commented Feb 9, 2024

Here's how I did it for Parcel, I think I also had the exact same error there:

In node/Cargo.toml, add

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["custom"], default-features = false }

and then in the wasm/* JS wrappers:

  const {instance} = await WebAssembly.instantiateStreaming(fetch(input), {
    env: {
      ...napi,
      __getrandom_custom: (ptr, len) => {
        let buf = env.memory.subarray(ptr, ptr + len);
        crypto.getRandomValues(buf);
      },
    },
  });

@devongovett devongovett merged commit 97d9e82 into parcel-bundler:master Feb 10, 2024
3 checks passed
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.

None yet

4 participants