From 0a87a6d7cb05e51adaafaa540a191393659b76b7 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Fri, 15 Mar 2024 14:24:10 +0100 Subject: [PATCH] WASM size optimizations --- Cargo.toml | 7 +++++++ src/main.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index eeb0217..e257cea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,6 +59,12 @@ ssr = [ "leptos_router/ssr", ] +[profile.wasm-release] +inherits = "release" +opt-level = 'z' +lto = true +codegen-units = 1 + [package.metadata.leptos] # The name used by wasm-bindgen/cargo-leptos for the JS/WASM bundle. Defaults to the crate name output-name = "rezervator" @@ -108,3 +114,4 @@ lib-features = ["hydrate"] # # Optional. Defaults to false. lib-default-features = false +lib-profile-release = "wasm-release" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 8b1463f..b054802 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,7 +93,7 @@ async fn main() -> std::io::Result<()> { ) .service(appearance::upload) .service(Files::new("/", site_root)) - //.wrap(middleware::Compress::default()) + .wrap(middleware::Compress::default()) }) .bind(srv_conf.network().bind_address())? .run()