feat: wasm-splitting library support for future cargo-leptos integration

This commit is contained in:
Greg Johnston
2025-05-17 15:00:38 -04:00
parent 13110a35e2
commit f0b7e7445b
7 changed files with 235 additions and 3 deletions

View File

@@ -24,9 +24,14 @@ pub fn lazy_impl(
fun.sig.ident.span(),
);
quote! {
#[cfg_attr(feature = "split", wasm_split::wasm_split(#converted_name))]
#fun
let is_wasm = cfg!(feature = "csr") || cfg!(feature = "hydrate");
if is_wasm {
quote! {
#[::leptos::wasm_split::wasm_split(#converted_name)]
#fun
}
} else {
quote! { #fun }
}
.into()
}