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

Consider shipping wasm files to npm #58

Open
TzviPM opened this issue Dec 7, 2023 · 2 comments
Open

Consider shipping wasm files to npm #58

TzviPM opened this issue Dec 7, 2023 · 2 comments

Comments

@TzviPM
Copy link

TzviPM commented Dec 7, 2023

I'm trying to use hash-wasm's argon2 implementation with Vercel's Edge runtime and running into an compilation error. It seems hash-wasm's dist files include a hard-coded string of the wasm base64-encoded and then run through WebAssembly.compile. Dynamic code evaluation isn't supported in that runtime (https://nextjs.org/docs/messages/edge-dynamic-code-evaluation).

Wasm files can be imported differently and handled by nextjs during bundling (ex. import someWasm from './some.wasm?module') but the wasm outputs from hash-wasm don't seem to be shipped as independant artifacts with the library code.

I imagine having access to the wasm files could be useful for other situations as well.

Would you be open to a PR to add this?

@Daninet
Copy link
Owner

Daninet commented Dec 7, 2023

Implementing alternative ways of loading binaries would increase the complexity of the library and I want to avoid that.
Cloudflare and Vercel requires a non-standard way of loading WASM binaries. At this moment I consider it something that needs to be fixed on their side by allowing all standardized ECMAScript / WASM APIs to work properly.

@ComicScrip
Copy link

If anyone really needs it and can't wait for Vercel and CF to change their ways, I've just made a (little hacky) fork that is runnable on Vercel Edge and CF Workers. 😄

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

No branches or pull requests

3 participants