This new tutorial goes a bit more in depth than the extant tutorials we've had for Rust and WebAssembly. The goal is to introduce all the topics you need when doing real Rust+Wasm development, all with a single running example to give continuity.
Topics covered include:
Setting up the toolchain and making a hello world
Designing Rust programs for WebAssembly
Debugging
Time profiling
Code size profiling
Every chapter also has exercises, if you want to challenge yourself.
If you follow along with the tutorial, please take notes along the way!! Your feedback would be incredibly valuable!
I couldn't find the npm-debug.log file, but here's the output of the command:
npm init --verbose wasm-app www
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli '/usr/bin/npm',
npm verb cli 'init',
npm verb cli '--verbose',
npm verb cli 'wasm-app',
npm verb cli 'www' ]
npm info using npm@6.4.1
npm info using node@v11.1.0
npx: installed 1 in 1.381snfo using node@v11.1.0
cloning the template failed!o using node@v11.1.0
npm verb exit [ 0, true ]
npm timing npm Completed in 1619ms
npm info ok
I'm fumbling in the dark a bit, but if you manually edit /.bin/create-wasm-app.js to add a console.log fileName you can see if the problem is with the location of the destination directory. Adding a console.log process.argv might also provide useful info, since the third arg is used to provide the fileName value.
Hmm... sometimes the cloning happens without errors, so I was able to go a step further, but then another error happens, this time on the browser (I'm using thttpd -d www -p 8080 to serve the files):
bootstrap.js:5 Error importing `index.js`: TypeError: Failed to resolve module specifier "hello-wasm-pack". Relative references must start with either "/", "./", or "../".
catch.e @ bootstrap.js:5
First: the best way to get help with issues with create-wasm-app is to file an issue on the project's issue tracker: Sign in to GitHub · GitHub
I'm a bit confused that you can run the git clone ... manually, but that it doesn't work in the script which is pretty much only doing that too.
Can you file an issue and provide precise steps to reproduce, as well as some info about what OS you're running, and which directories you're running these commands in, etc? Thanks!
After that, you can point your browser to http://localhost:8080/ and this error message should appear on the web console:
bootstrap.js:5 Error importing `index.js`: TypeError: Failed to resolve module specifier "hello-wasm-pack". Relative references must start with either "/", "./", or "../".
I liked the tutorial very much. Near the end it really depends on which of the exercises you did, and if sometimes did not totally much, but enough to work through. I took it a bit further and made a 3d version. See https://gameoflife3d.gklijs.tech source at https://github.com/gklijs/game-of-life.