wasm-bindgen/examples/without-a-bundler-no-modules
Alex Crichton 995be7c027 Replace target flags with --target
This commit deprecates the `--web`, `--no-modules`, and `--nodejs` flags
in favor of one `--target` flag. The motivation for this commit is to be
consistent between `wasm-bindgen` and `wasm-pack` so documentation for
one is applicable for the other (so we don't have to document everywhere
what the translation is between flags). Additionally this should make it
a bit easier to add new targets (if necessary) in the future as it won't
add to the proliferation of flags.

For now the old flags (like `--web`) continue to be accepted, but
they'll be removed during the next set of breaking changes for
`wasm-bindgen`.
2019-03-21 14:00:33 -07:00
..
src Implement the local JS snippets RFC 2019-03-05 08:00:47 -08:00
Cargo.toml Implement the local JS snippets RFC 2019-03-05 08:00:47 -08:00
index.html Replace target flags with --target 2019-03-21 14:00:33 -07:00
README.md Replace target flags with --target 2019-03-21 14:00:33 -07:00

Without a Bundler Using --target no-modules

View documentation for this example online

You can build the example locally with:

$ wasm-pack build --target no-modules

and then opening index.html in a browser should run the example!

Note that this example is in contrast to the without a bundler example which performs a similar purpose except it uses --target no-modules instead of --target web. The main difference here is how the shim JS and module are loaded, where this example uses old-school script tags while --target web uses ES modules.