Inject Rust/WASM via custom code block?

Had this completely random thought and wanted to see if it’s been explored before.

Is it possible to write Rust code, create a .WASM build, host it somewhere, then load it into a Webflow page via custom code embed?

Should be fine but it seems like overkill compared with JS or TS for most apps. Retrieving and instantiating your WASM code would likely involve a fetch, so you need to make certain your hosting env supports CORS.

Outside of that, not much special I think.

Yes, you can write Rust code, compile it to WebAssembly (.wasm), host it on a CDN or your own server, and load it into a Webflow page using a custom code embed. First, use wasm-pack to compile your Rust code into a WebAssembly module with JavaScript bindings. Then, upload the .wasm file to a hosting service like Cloudflare, AWS S3, or GitHub Pages. In Webflow, use a <script> tag to fetch and instantiate the .wasm module with JavaScript (WebAssembly.instantiateStreaming or a loader like wasm-bindgen). Ensure CORS is configured properly on your hosting to allow Webflow to access the file