I have built a WASM module and gotten it to work within an initial Next.js app. I built it with wasm-pack build --target web. So far, I've only been able to get it working within Next.js by copying the package files into a directory within my Next.js project. I can then import it by directly pointing to the folder within:
example:
const wasm = await import("@/wasm/my_module/my_module");
While, I am able to install the package by pointing npm to the package directory:
npm i ../my_module/pkg
I have not been able to import from the installed package.
const wasm = await import("my_module"); // This gives me a runtime error of "Module not found: Can't resolve 'my_module'"
I would like to be able to import my wasm from an installed NPM package.