Next.js Discord

Discord Forum

Trouble using wasm package on server side components

Unanswered
Satin posted this in #help-forum
Open in Discord
SatinOP
Hi all,

I am trying to use a wasm package on my Next.js app (server side components). The package in question is https://github.com/vemonet/nanopub-rs . I created a simple repro repository but before I post an issue I just wanted to check here that this is not a known issue that I am perhaps overlooking.

I just created a new next app and added the package, imported and tried to use it but I get:

Error: ENOENT: no such file or directory, open '/{root}/reproduction-app/.next/server/vendor-chunks/node_bg.wasm'

The wasm file is definitely not where it's being looked for (it's in node_modules). I am not sure if there is some config or workaround to working with wasm in server-side components that I'm overlooking. Te package works well with 'use client', and I have also tested it on a Vite app and a Node+Express app without issues.

Appreciate the guidance if anyone has ran into a similar issue before, otherwise I'll open an issue on GitHub. Thanks!

0 Replies