Adding actix-cors to a simple actix-web + leptos template causes compiler target issues?

⚓ Rust    📅 2025-12-22    👤 surdeus    👁️ 6      

surdeus

Commands I did, exactly in this order

cargo leptos new --git leptos-rs/start
//change to new dir
cargo add actix-cors
cargo leptos watch

error: This wasm target is unsupported by mio. If using Tokio, disable the net feature.
  --> C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\mio-1.1.1\src\lib.rs:44:1
   |
44 | compile_error!("This wasm target is unsupported by mio. If using Tokio, disable the net feature."); 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  

error[E0432]: unresolved import `crate::sys::IoSourceState`
  --> C:\Users\me\.cargo\registry\src\index.crates.io-197f\mio-1.1.1\src\io_source.rs:14:5
   |
14 | use crate::sys::IoSourceState;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `IoSourceState` in `sys`

error[E0432]: unresolved import `crate::sys::tcp`
  --> C:\Users\me\.cargo\registry\src\index.crates.io-19497f\mio-1.1.1\src\net\tcp\listener.rs:20:5
   |
20 |     tcp::{bind, listen, new_for_addr},
   |     ^^^ could not find `tcp` in `sys`

error[E0432]: unresolved import `crate::sys::tcp`
  --> C:\Users\me\.cargo\registry\src\index.crates.io-1949f\mio-1.1.1\src\net\tcp\stream.rs:17:17
   |
17 | use crate::sys::tcp::{connect, new_for_addr};
   |                 ^^^ could not find `tcp` in `sys`

I've done a bit of research and it seems that since I'm trying to use CORS middleware on a wasm32-unknown-unknown target, I might be trying to do the impossible as per

which states
"Browsers do not allow WASM to make network requests. You need to write that part in Javascript and pass the results to WASM via FFI."

So, correct me if I'm wrong, but for my goal of letting the client bypass CORS without having to host the CORS middleware on the server end, I'll either:
A: Bundle a JS CORS middleware to the client so they can run it locally, or
B: Do the same t hing but bundle a Rust actix-cors to the client along with a JS FFI.

What do you all think?

3 posts - 3 participants

Read full topic

🏷️ Rust_feed