Hi everyone,
First, thanks for maintaining this package, it makes working with rust in nx really smooth =)
I tried to use the @monodon/rust nx plugin to work with wasm in an nx repository and I found some small bugs and maybe possible enhencements:
Bugs:
Enhancements:
- the wasm-pack executor directly runs
wasm-pack, which requires to have wasm-pack installed globally. I think wasm-pack is available as an npm dependency, so it would be possible to run it with npx in the executor and avoid a global installation no ? Also, the npm dependency could be added by the wasm-pack generator.
- Once the wasm package is generated by the executor, it is located in the dist folder and it can not be easily consumed from there by another js/ts app/lib of the repo. The easiest solution I found was to install the generated package as an npm dependencie. I don't know if it's a good practise, or if there is a more elegant solution. But if it appears to be a correct solution, maybe it could be added as an option to the wasm-pack executor ?
For now, I ended using nx-command to play arround the existing problems:
"targets": {
"build": {
"outputs": ["{options.output}"],
"executor": "nx:run-commands",
"options": {
"commands": [
"npx wasm-pack build libs/wasm-package --out-dir ../../dist/wasm/wasm-package --target bundler --dev --scope ml",
"npm i dist/wasm/wasm-package"
],
"parallel": false,
"output": "dist/wasm/wasm-package"
}
},
It's an easy fallback solution, but it would be awesome to have wasm-support with this plugin! I am willing to help and I can provide a pull request for the two enhencements if they're found to be relevant =)
Hi everyone,
First, thanks for maintaining this package, it makes working with rust in nx really smooth =)
I tried to use the @monodon/rust nx plugin to work with wasm in an nx repository and I found some small bugs and maybe possible enhencements:
Bugs:
-pparameter to provide the project root to the wasm-pack command. I think that PR fix(rust): wasm-pack arguments + fix libs/apps relative paths #22 fixes this.Enhancements:
wasm-pack, which requires to havewasm-packinstalled globally. I think wasm-pack is available as an npm dependency, so it would be possible to run it withnpxin the executor and avoid a global installation no ? Also, the npm dependency could be added by thewasm-packgenerator.For now, I ended using
nx-commandto play arround the existing problems:It's an easy fallback solution, but it would be awesome to have wasm-support with this plugin! I am willing to help and I can provide a pull request for the two enhencements if they're found to be relevant =)