diff --git a/packages/cli/src/build/bundle.rs b/packages/cli/src/build/bundle.rs index 15aae2b566..7e3e30182e 100644 --- a/packages/cli/src/build/bundle.rs +++ b/packages/cli/src/build/bundle.rs @@ -562,8 +562,12 @@ impl AppBundle { let input_path = input_path.to_path_buf(); let bindgen_outdir = bindgen_outdir.to_path_buf(); let name = self.build.krate.executable_name().to_string(); - let keep_debug = self.build.krate.config.web.wasm_opt.debug; let reference_types = self.build.krate.config.web.wasm_opt.reference_types; + let keep_debug = + // if we're in debug mode, or we're generating debug symbols, keep debug info + (self.build.krate.config.web.wasm_opt.debug || self.build.build.debug_symbols) + // but only if we're not in release mode + && !self.build.build.release; let start = std::time::Instant::now(); tokio::task::spawn_blocking(move || { @@ -574,9 +578,9 @@ impl AppBundle { .debug(keep_debug) .demangle(keep_debug) .keep_debug(keep_debug) - .reference_types(reference_types) - .remove_name_section(true) - .remove_producers_section(true) + .reference_types(keep_debug || reference_types) + .remove_name_section(!keep_debug) + .remove_producers_section(!keep_debug) .out_name(&name) .generate(&bindgen_outdir) }) @@ -669,11 +673,10 @@ impl AppBundle { .context("Failed to get static routes from server")? .text() .await - .map(|raw| serde_json::from_str::(&raw).unwrap()) + .map(|raw| serde_json::from_str::>(&raw).unwrap()) .inspect(|text| tracing::debug!("Got static routes: {text:?}")) .context("Failed to parse static routes from server")? - .lines() - .map(|line| line.to_string()) + .into_iter() .map(|line| async move { tracing::info!("SSG: {line}"); reqwest::Client::builder() diff --git a/packages/cli/src/cli/build.rs b/packages/cli/src/cli/build.rs index ed2f9d48e3..4a9ae3802c 100644 --- a/packages/cli/src/cli/build.rs +++ b/packages/cli/src/cli/build.rs @@ -51,6 +51,13 @@ pub(crate) struct BuildArgs { #[clap(long, default_value_t = true)] pub(crate) inject_loading_scripts: bool, + /// Generate debug symbols for the wasm binary [default: true] + /// + /// This will make the binary larger and take longer to compile, but will allow you to debug the + /// wasm binary + #[clap(long, default_value_t = true)] + pub(crate) debug_symbols: bool, + /// Information about the target to build #[clap(flatten)] pub(crate) target_args: TargetArgs, diff --git a/packages/fullstack/src/render.rs b/packages/fullstack/src/render.rs index e265450223..c7e6418695 100644 --- a/packages/fullstack/src/render.rs +++ b/packages/fullstack/src/render.rs @@ -175,7 +175,6 @@ impl SsrRendererPool { virtual_dom.provide_root_context(document.clone() as std::rc::Rc); // poll the future, which may call server_context() - tracing::info!("Rebuilding vdom"); with_server_context(server_context.clone(), || virtual_dom.rebuild_in_place()); let mut pre_body = String::new();