How to use javascript package with wasm dependency in Workers


I’m trying to create a module Worker and added a package that has WASM dependencies. When I try to run the worker I get an error

No loader is configured for “.wasm” files

I’ve tried to add a wasm_module binding in my wrangler.toml but then I end up with another error

You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code

Importing the wasm files from the node_modules folder and then removing the wasm_module binding just puts me back to square one.

Has anyone successfully imported a package with WASM dependencies?