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

WasmHighwayHash won't load on unsupported platforms #19

Closed
rrichardson opened this issue Nov 9, 2021 · 1 comment · Fixed by #23
Closed

WasmHighwayHash won't load on unsupported platforms #19

rrichardson opened this issue Nov 9, 2021 · 1 comment · Fixed by #23

Comments

@rrichardson
Copy link

When explicitly trying to load and run WasmHighwayHash on Mac M1:

const { WasmHighwayHash } = require("highwayhasher"); 

I am met with

Uncaught Error: unknown platform-arch: darwin-arm64 

I figured this would be fixed by the effort to fix #12, but there might also be an easier fix as well, so I'm posting this issue separately.
It seems that the fundamental issue is the native Node loader is invoked not matter what, even if the user explicitly tried to load WasmHighwayHash.

This is because

export { NativeHighwayHash as HighwayHash } from "./native";  

is run in index_node.ts not matter what.

The workaround is to directly require the browser/cjs/index_browser.js file.
e.g.

import { WasmHighwayHash as hhashJs } from "highwayhasher/dist/browser/cjs/index_browser"; 

Which seems to work just fine in my typescript application. YMMV

@nickbabcock
Copy link
Owner

nickbabcock commented Nov 9, 2021

You're right, that is a bug. Thank you for the report. Let me think about how to fix that. Maybe I need to move it to the init stage or delay importing until called 🤔

In the meantime, I pushed out build that includes M1 support. I don't have a M1 mac, so let me know if it works.

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 a pull request may close this issue.

2 participants