toyjs icon indicating copy to clipboard operation
toyjs copied to clipboard

Build instructions?

Open ethanfrey opened this issue 3 years ago • 1 comments
trafficstars

This seems like an interesting project and I am trying to test it out. I am especially interested in the web / wasm version. But I got errors when compiling. I got some working, but it would be great to leave some comments, especially when it doesn't work out of the box on a recent 1.61 install.

First, please not that it requires nightly build to run:

cargo build --release --bin cli complains, but cargo +nightly build --release --bin cli does seem to work

Second, it would be great to give a command to compile the wasm version (and ideally how to serve locally):

cargo +nightly build --release --target wasm32-unknown-unknown errors. It works when I add --bin cli, but I assume that is not what I want for wasm32?

I'd be excited to play around with embedded js interpreter in wasm, and happy for any tips

ethanfrey avatar Oct 06 '22 11:10 ethanfrey

I think this works:

cd toyjs_web
cargo +nightly build --release --target wasm32-unknown-unknown
npm install
npm run dev

But npm install failed on my Mac m1:

npm ERR! .../rust/toyjs/toyjs_web/node_modules/wasm-pack/binary.js:19
npm ERR!   throw new Error(`Unsupported platform: ${type} ${arch}`);
npm ERR!   ^
npm ERR!
npm ERR! Error: Unsupported platform: Darwin arm64

(This was closed upstream and on master but not in a tagged / published npm release, so I guess out of scope for this repo... I may add an PR with instructions for m1 if you wish)

ethanfrey avatar Oct 06 '22 12:10 ethanfrey