Sveltekit+Rust SSR Template Proof of Concept

TLDR: Uses iframes and Sveltekit pages to run wasm on server side.

  • fix-new-urls.js is run during node run build to bypass #5169
  • Wasm-bindgen glue code is not instanceable so it has to be isolated with iframes if one desires to use a wasm component more than once or without explicit support by the binary(for example supplying an instance id with each call) It is instanceable when you use structs in rust and this template will be updated accordingly(soon).
  • "Wasm components" are implemented as Sveltekit pages due to lack of top level async support in Svelte components #5501

Requirements

Steps

  • npm install
  • Be sure to run npm run dev at least once to compile rust stuff

Notes

  • You may get internal server errors when you run npm run dev. Just terminate the process and run again or ignore.