How do you structure a NodeJS package, containing wrapped C++ code that's compiled into web assembly, so that when you run npm install <package name>
, the compilation step happens?
I have a package mypackage
configured so that when I run npm run build
in its project directory, C++ code is compiled into web assembly, and this is then bundled with other Javascript for the package.
I'm now trying to use this package from another project, and if I run npm install --save mypackage
, it installs the package's Javascript, but doesn't run it's build process, so none of the web assembly is created, resulting in a broken package.