{"record":{"id":"8c9b747969aacfe2","repo":"DioxusLabs/dioxus","slug":"wasm-split-functions-must-be-async-use-a-lazyload","errorCode":null,"errorMessage":"wasm_split functions must be async. Use a LazyLoader with synchronous functions instead.","messagePattern":"wasm_split functions must be async\\. Use a LazyLoader with synchronous functions instead\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/wasm-split/wasm-split-macro/src/lib.rs","lineNumber":13,"sourceCode":"use proc_macro::TokenStream;\n\nuse digest::Digest;\nuse quote::{format_ident, quote};\nuse syn::{FnArg, Ident, ItemFn, ReturnType, Signature, parse_macro_input, parse_quote};\n\n#[proc_macro_attribute]\npub fn wasm_split(args: TokenStream, input: TokenStream) -> TokenStream {\n    let module_ident = parse_macro_input!(args as Ident);\n    let item_fn = parse_macro_input!(input as ItemFn);\n\n    if item_fn.sig.asyncness.is_none() {\n        panic!(\n            \"wasm_split functions must be async. Use a LazyLoader with synchronous functions instead.\"\n        );\n    }\n\n    let LoaderNames {\n        split_loader_ident,\n        impl_import_ident,\n        impl_export_ident,\n        load_module_ident,\n        ..\n    } = LoaderNames::new(item_fn.sig.ident.clone(), module_ident.to_string());\n\n    let mut desugard_async_sig = item_fn.sig.clone();\n    desugard_async_sig.asyncness = None;\n    desugard_async_sig.output = match &desugard_async_sig.output {\n        ReturnType::Default => {\n            parse_quote! { -> ::std::pin::Pin<Box<dyn ::std::future::Future<Output = ()>>> }\n        }","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/wasm-split/wasm-split-macro/src/lib.rs#L1-L31","documentation":"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.","triggerScenarios":"Thrown at packages/wasm-split/wasm-split-macro/src/lib.rs:13 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the wasm_split function async. For synchronous functions use a LazyLoader instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}