-
Notifications
You must be signed in to change notification settings - Fork 9
server (api) example? #22
Comments
Hi @YuriGor! That's a good point which I wasn't aware when I was creating this repository. My main purpose was to bring it to client side (browser). If I'll have time in the coming weeks, I'll dig in and prepare some example for server side. I think the main reason why it doesn't work at this point is because Line 6 in 9f1d2a0
There are other options available including In case you urgently need it on server, that's a good starting point |
Thanks a lot!
|
Ok, finally, by using this example Main trick was to feed js wrapper produced by wasm-pack with wasm module manually imported in edge api instead of letting him fail to fetch wasm automatically. It's still not perfect, because works only with edge runtime which has significant limitations. I'll maybe fork and enhance that example with second wasm prepared by wasm-pack, so people will have more options, because currently wasm+nextjs is still shadow zone. If you will find a way to do the same with nodejs runtime on backend - would be great. With edge runtime a lot of questions arise about session, db, auth etc. |
Thank you @YuriGor. |
Another example / more findings here: vercel/next.js#29362 (comment) |
Hello, thanks for template.
Could you share some example how to import/use wasm in api?
I tried to add /pages/api/test.js:
async loading as you do in context is failing due to fetch issue:
direct import also doesn't work:
The text was updated successfully, but these errors were encountered: