Super cool!
One idea of mine, that made my life simpler was to add a shellscript to build the rust lib and run the script automatically with each npm-install, by adding a postinstall script to package.json.
Although I don't know if this is an issue for deploying it on vercel and so on. But the shellscript is already nice as well and I guess there is a way better solution than this :D
#!/bin/bash
# build-rust.sh
# Change to the rust-lib directory
cd rust-lib
# Run wasm-pack build with the target web
wasm-pack build --target web
# Check if the build was successful
if [ $? -eq 0 ]; then
# If successful, copy the contents of rust-lib/pkg to src/lib
cp -r pkg ../src/lib/
echo "Build successful. Output copied to src/lib."
else
echo "Build failed. Please check the error messages."
fi
Super cool! One idea of mine, that made my life simpler was to add a shellscript to build the rust lib and run the script automatically with each npm-install, by adding a postinstall script to package.json.
Although I don't know if this is an issue for deploying it on vercel and so on. But the shellscript is already nice as well and I guess there is a way better solution than this :D