Skip to content

Commit 9e699ac

Browse files
authoredFeb 2, 2024
Add deployment note for first wasm-pack build --target web example (#3819)
1 parent 305cb25 commit 9e699ac

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎guide/src/examples/without-a-bundler.md

+16
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,25 @@ Otherwise the rest of the deployment magic happens in `index.html`:
3535
{{#include ../../../examples/without-a-bundler/index.html}}
3636
```
3737

38+
> **Note**: You cannot directly open `index.html` in your web browser due to [CORS][cors]
39+
> limitations. Instead, you can set up a quick development environment using
40+
> Python's built-in HTTP server:
41+
> ```sh
42+
> wasm-pack build --target web
43+
> python3 -m http.server 8080
44+
> ```
45+
> If you don't have Python installed, you can also use [miniserve][miniserve] which
46+
> is installable via Cargo:
47+
> ```sh
48+
> cargo install miniserve
49+
> miniserve . --index "index.html" -p 8080
50+
> ```
51+
3852
And that's it! Be sure to read up on the [deployment options][deployment] to see
3953
what it means to deploy without a bundler.
4054
55+
[cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
56+
[miniserve]: https://crates.io/crates/miniserve
4157
[deployment]: ../reference/deployment.html
4258
4359
## Using the older `--target no-modules`

0 commit comments

Comments
 (0)