Closed kraenhansen closed 5 years ago
I'm unable to reproduce this. I followed your directions exactly, but everything works fine.
What is your wasm-pack version? What OS are you using?
I'm on MacOS and I'm running wasm-pack 0.6.0
and I have run rustup update
, so perhaps thats the root cause.
I don't know how to update wasm-pack
? Neither https://github.com/rustwasm/wasm-pack nor https://rustwasm.github.io/wasm-pack/ tells me how to do that.
Yeah, that's probably the reason: your wasm-pack is way out of date.
You can update it by just installing the latest version.
I'm on wasm-pack 0.8.1
now and the issue persists. I can fix the error by changing the contents of js/index.js
to:
import("../index").catch(console.error);
Apparently the output of wasm-bindgen is emitted to disk into the ./index
folder:
$ ls -la index
total 328
drwxr-xr-x 9 kraenhansen staff 288 19 Jun 20:37 .
drwxr-xr-x 16 kraenhansen staff 512 19 Jun 20:37 ..
-rw-r--r-- 1 kraenhansen staff 1 19 Jun 20:37 .gitignore
-rw-r--r-- 1 kraenhansen staff 1376 19 Jun 20:37 README.md
-rw-r--r-- 1 kraenhansen staff 417 19 Jun 20:37 package.json
-rw-r--r-- 1 kraenhansen staff 80 19 Jun 20:37 rust_webpack_template.d.ts
-rw-r--r-- 1 kraenhansen staff 8092 19 Jun 20:37 rust_webpack_template.js
-rw-r--r-- 1 kraenhansen staff 329 19 Jun 20:37 rust_webpack_template_bg.d.ts
-rw-r--r-- 1 kraenhansen staff 138044 19 Jun 20:37 rust_webpack_template_bg.wasm
Just to make sure: you tried completely deleting the my-app
directory and re-doing all the steps again from scratch (including npm init rust-webpack my-app
)?
That fixed it - thanks!
It would be really nice if some assertions were made about the versions of the various tools in the toolchain and nice warnings would be printed if the user is running outdated tools. Especially starting out, its easy to forget which tools you've installed and how, as learning Rust could be a thing you do on-and-off between other things.
Glad it's working now. Wasm-pack already does that check and outputs a warning, but that feature hasn't been released yet (it should be in the next release).
Describe the Bug
Running the
start
script yields an error.Steps to Reproduce
npm init rust-webpack my-app
template
andnpm install
(because of #148)npm start
Expected Behavior
I would expect to load the template project and see "hello world" printed in the console of the browser.
Actual Behavior
No visual change in the browser (except for the title of the tab).
The following output in my terminal when running
npm start
:The browser console outputs: