jjh4450 / my_first_WASM

This is a simple project to test WebAssembly (WASM) technology. This project is a simple "Hello World" written in Rust and compiled with WASM using wasm-pack.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My Fist WASM Project

This is a simple project to test WebAssembly (WASM) technology. This project is a simple "Hello World" written in Rust and compiled with WASM using wasm-pack.

setup rust

for linux(or wsl)

install rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
...
source $HOME/.cargo/env

for windows

https://www.rust-lang.org/tools/install

setup wasm-pack

cargo install wasm-pack

hello-wasm

This is the Rust project that will be compiled to WASM. It is a simple "Hello World" project. command to create the project:

cd path/to/your/project
wasm-pack new hello-wasm

build the project

wasm-pack build --target web

test the project

use new_version(recommended)

cd new_version

run index.html with http-server or Live Server

use old_version

The Internet and official documentaion use webpack. However, this currently causes many compatibility issues. Therefore, I recommend using the new_version method.

cd old_version
npm install
npm run start

About

This is a simple project to test WebAssembly (WASM) technology. This project is a simple "Hello World" written in Rust and compiled with WASM using wasm-pack.


Languages

Language:Rust 38.3%Language:HTML 31.1%Language:JavaScript 30.6%