Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Simplify and document usage of a wasm-bindgen WebAssembly module in a Next.js app #29302

Closed
gthb opened this issue Sep 22, 2021 · 2 comments
Closed

Comments

@gthb
Copy link

gthb commented Sep 22, 2021

Describe the feature you'd like to request

I want it to be fairly straightforward to use a Rust WebAssembly module created by wasm-bindgen in a Next.js project

Describe the solution you'd like

With reference to https://github.com/gthb/try-to-use-wasm-in-next.js/blob/main/README.md I would like:

  1. the two apparent Next.js caching bugs to be fixed (if I'm right that they are Next.js caching bugs)
  2. the Next.js documentation to contain a guide leading people through the apparent necessary steps, including guidance on what to do about SSR (making Node support WebAssembly there, or maybe avoid running WebAssembly on the server side if it's not absolutely necessary)
  3. maybe some of those things working out of the box rather than requiring several scattered bits of obscure configuration (but yeah, I get that this is still a gradually maturing area...)

Describe alternatives you've considered

Building the Rust WebAssembly module differently or Babel-compiling it, so that it doesn't have import statements, so it doesn't need to be ESM. I did not quickly find success that way.

@gthb
Copy link
Author

gthb commented Sep 23, 2021

Note: I've realized that the wasm-pack output example I used in that writeup is old and doesn't reflect current wasm-pack output.

I have not yet succeeded in getting a simple ES module built by current wasm-pack to work under Next.js. I have just contributed an example to webpack demonstrating simple usage of such a module: webpack/webpack#14313 but trying to integrate that same module in Next.js I hit several roadblocks, which I am in the process of writing up in a concise way.

@gthb
Copy link
Author

gthb commented Sep 24, 2021

I hit several roadblocks, which I am in the process of writing up in a concise way.

See writeup and reproduction steps at #29362

@vercel vercel locked and limited conversation to collaborators Sep 27, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants