Is there a recommended approach to publishing a library utilizing a wasm binary on npm?
During my attempts, I've come across several challenges. My ideal scenario would involve:
A process that is completely transparent to the user. Users should be able to simply run
npm install
on the package and then
, without needing to worry about whether a wasm binary is involved or not.import {my_function} from my_package
Compatibility with all major asset bundlers. Regardless of whether the user employs webpack, rollup, parcel, or any other tool, no configuration should be necessary to bundle the wasm file, distribute it alongside other assets, and ensure access from within the library.
Efficiency. It would be preferable for the wasm file to not be inlined within a JavaScript file, allowing for parsing and compilation in a streaming manner. While this aspect is slightly less crucial than the previous ones, it would be advantageous to leverage the performance benefits offered by wasm.