DioxusLabs/dioxus · error

wasm_split functions must be async. Use a LazyLoader with sy

Error message

wasm_split functions must be async. Use a LazyLoader with synchronous functions instead.

What it means

The wasm_split attribute was applied to a non-async function. Split modules are loaded over the network so their entry functions must be async; synchronous functions should use the LazyLoader mechanism instead, and the macro panics at expansion time.

Source

Thrown at packages/wasm-split/wasm-split-macro/src/lib.rs:13

use proc_macro::TokenStream;

use digest::Digest;
use quote::{format_ident, quote};
use syn::{FnArg, Ident, ItemFn, ReturnType, Signature, parse_macro_input, parse_quote};

#[proc_macro_attribute]
pub fn wasm_split(args: TokenStream, input: TokenStream) -> TokenStream {
    let module_ident = parse_macro_input!(args as Ident);
    let item_fn = parse_macro_input!(input as ItemFn);

    if item_fn.sig.asyncness.is_none() {
        panic!(
            "wasm_split functions must be async. Use a LazyLoader with synchronous functions instead."
        );
    }

    let LoaderNames {
        split_loader_ident,
        impl_import_ident,
        impl_export_ident,
        load_module_ident,
        ..
    } = LoaderNames::new(item_fn.sig.ident.clone(), module_ident.to_string());

    let mut desugard_async_sig = item_fn.sig.clone();
    desugard_async_sig.asyncness = None;
    desugard_async_sig.output = match &desugard_async_sig.output {
        ReturnType::Default => {
            parse_quote! { -> ::std::pin::Pin<Box<dyn ::std::future::Future<Output = ()>>> }
        }

View on GitHub (pinned to 24f6a829df)

Solutions

  1. Make the wasm_split function async. For synchronous functions use a LazyLoader instead.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/wasm-split/wasm-split-macro/src/lib.rs:13 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/8c9b747969aacfe2. Report an issue: GitHub.