Wrangler dev and publish don't work with async code
vladinator1000 opened this issue · 2 comments
Hi there, I made a reproduction repo of a case where I just couldn't publish my code with wasm because of an error unresolved import "sys"
.
cargo build
and cargo test
work just fine so I'm not sure what's causing this. I also posted this in a question in the Cloudflare community.
Hey @vladinator1000 - unfortunately, not all Rust code will work automatically with wasm-pack. there are a couple of things to understand here:
- when wrangler builds a
type = "rust"
project, it callswasm-pack build
wasm-pack build
callscargo build --target wasm32-unknown-unknown
If you run either of those above commands on their own, you'll see that you get the same error.
Unfortunately, I think one of your dependencies is relying on system level APIs that are not available in WASM-world. This is documented more fully here.
I'm going to close this since it's not something that can be solved in wrangler or this template. Hope this helps!
Thank you 😍 @EverlastingBugstopper