wave-insight-web

Crates.iowave-insight-web
lib.rswave-insight-web
version0.1.0
sourcesrc
created_at2022-03-10 07:08:25.055528
updated_at2022-03-10 07:08:25.055528
descriptionWeb Front-End for Wave-Insight
homepagehttps://wave-insight.io
repositoryhttps://github.com/Wave-Insight/web
max_upload_size
id547410
size22,634
Junzhuo ZHOU (zao111222333)

documentation

https://docs.rs/crate/wave-insight-web/latest

README

About

This template demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WebAssembly file, using Yew, wasm-bindgen, and wasm-pack.

Note: yew-wasm-pack-template is the full-featured counterpart to this template, integrating many common web technologies.

Usage

1) Install Rust and wasm-pack

Follow the instructions at https://www.rust-lang.org/tools/install and follow the installation link at wasm-pack.

2) Build

Enter wasm-pack build --target web from your project's root directory.

3) [temporary] Bundle

Enter rollup ./main.js --format iife --file ./pkg/bundle.js from your project's root directory.

Note: Until wasm-pack RFC #6 is implemented there is no available option to generate a single amalgamated JavaScript file. In the interim a bundler, such as Rollup, must be used.

4) [optional] Test Run

Run a webserver from your project's root directory, such as with the Python 3 command: python -m http.server 8080, and load http://localhost:8080/ in a browser to run the app.

Note: It's expected behavior for the browser console to display an error similar to "WebAssembly.instantiateStreaming failed. Assuming this is because your server does not serve wasm with application/wasm MIME type." Your production webserver should be configured to associate WebAssembly files with the application/wasm MIME type.

If you have become an orthodox Rust person than you can use see or miniserve servers to share assets:

miniserve -p 8000 --index index.html

5) Deploy

Access your generated build artifacts, bundle.js and yew_wasm_pack_minimal_bg.wasm, in ./pkg from your project's root directory.

Commit count: 1

cargo fmt