Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add keep-symbols flag, change ssg format to Vec<String> #3217

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/cli/src/build/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {
Expand All @@ -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)
})
Expand Down Expand Up @@ -669,11 +673,10 @@ impl AppBundle {
.context("Failed to get static routes from server")?
.text()
.await
.map(|raw| serde_json::from_str::<String>(&raw).unwrap())
.map(|raw| serde_json::from_str::<Vec<String>>(&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()
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion packages/fullstack/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ impl SsrRendererPool {
virtual_dom.provide_root_context(document.clone() as std::rc::Rc<dyn Document>);

// 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();
Expand Down
Loading