Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 1.43 KB

README.md

File metadata and controls

19 lines (12 loc) · 1.43 KB

Rust WASM with generated JavaScript and TypeScript bindings

npm start

Enter numbers and calculate their sum of squares. 1,2,3,4 produces 30 through Rust. Open /regular for the separate WASM download, or download /dist/index.html and open that HTML offline. npm run build creates both forms.

prebuilt contains real wasm-pack output, including engine.d.ts and engine_bg.wasm.d.ts. The matching source/artifact hashes allow an SDK-free first run. The module is initialized with its explicitly imported WASM URL, which also becomes an embedded data URL in portable HTML.

To edit Rust, install Rust, its wasm32-unknown-unknown target and wasm-pack:

rustup target add wasm32-unknown-unknown

Run tinybuild from a terminal with the tools available. Set WASM_PACK to an executable path to select a compiler and force a real build. The build task runs wasm-pack before esbuild and publishes its JS, WASM and declarations together after success. JS/CSS edits skip Rust compilation. Changes to the Rust source, Cargo files or compiler script rerun it; a failed compile preserves the last working generated files.

Keep dependencies in native/Cargo.toml and native/Cargo.lock; Cargo manages their compilation. The complete tinybuild config remains available for customization. Rebuild the prebuilt snapshot and its hashes when deliberately distributing a new SDK-free sample.