Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "set up and run a webserver" step is missing #582

Open
meggsOmatic opened this issue Dec 8, 2024 · 0 comments
Open

The "set up and run a webserver" step is missing #582

meggsOmatic opened this issue Dec 8, 2024 · 0 comments

Comments

@meggsOmatic
Copy link

The first page of the "Beginner" section ends with this sidebar:

If you intend to use your WASM module in a plain HTML website, you'll need to tell wasm-pack to target the web...

In my mind, the most straightforward thing to do with those instructions was to save the example HTML to a local tutorial1_window.html file and directly open it in a browser. That didn't work. Turns out cross-origin restrictions prevent importing ./pkg/tutorial1_window.js when using the file:// protocol.

For some programming backgrounds, it may be a very obvious assumption that "Of course I have already a full web development toolchain set up, which will obviously include a web server serving local static pages, as well as (this thing), (that thing), and (some other thing)".

On the other hand, this is a "Beginner" page, and Rust is primarily a native-code systems-programming language. It's reasonable that some Rust programmers will begin from a background that lacks that assumption.

python -m http.server and http://localhost:8000/tutorial1_window.html was easy once I figured out what the missing piece was. But it took quite some time to figure out what the missing piece was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant