Doc in question: https://docs.wasmer.io/sdk/wasmer-js/tutorials/run/
Rust example does not compile, but it is possible to still build them with these changes:
pulldown_cmark::html::write_html function is renamed to pulldown_cmark::html::write_html_io.
- Target
wasm32-wasi is removed from rustup and wasm32-wasip1 is used instead.
While these changes fix the compiling on the Rust side, the resulting binary doesn't work on the browser with the provided JS code while working fine on Wasmer CLI. The given error is emitted by the browser:
panicked at src/tasks/task_wasm.rs:38:43:
called `Result::unwrap()` on an `Err` value: Generic("Not able to serialize module")
I unfortunatelly could not find a workaround for this one.
package.json:
{
"name": "markdown_wasm",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"dependencies": {
"@wasmer/sdk": "^0.10.0"
},
"devDependencies": {
"vite": "^8.0.10"
}
}
Cargo.toml:
[package]
name = "markdown-renderer"
version = "0.1.0"
edition = "2024"
[dependencies]
pulldown-cmark = "0.13.3"
Doc in question: https://docs.wasmer.io/sdk/wasmer-js/tutorials/run/
Rust example does not compile, but it is possible to still build them with these changes:
pulldown_cmark::html::write_htmlfunction is renamed topulldown_cmark::html::write_html_io.wasm32-wasiis removed from rustup andwasm32-wasip1is used instead.While these changes fix the compiling on the Rust side, the resulting binary doesn't work on the browser with the provided JS code while working fine on Wasmer CLI. The given error is emitted by the browser:
I unfortunatelly could not find a workaround for this one.
package.json:
Cargo.toml: