From 18d8e6a53493457c4ed9681e2d62206d1cfd9686 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Fri, 30 May 2025 12:43:26 -0500 Subject: [PATCH] Fix dx bundle and release web builds (#4211) * remove fullstack flag * fix release web builds --- packages/cli/src/build/request.rs | 16 +++++++++------- packages/cli/src/cli/bundle.rs | 6 ------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/cli/src/build/request.rs b/packages/cli/src/build/request.rs index 847b7dfd7..5dd3107de 100644 --- a/packages/cli/src/build/request.rs +++ b/packages/cli/src/build/request.rs @@ -1203,8 +1203,10 @@ impl BuildRequest { .await .map_err(|e| anyhow::anyhow!("A task failed while trying to copy assets: {e}"))??; - // // Remove the wasm bindgen output directory if it exists - // _ = std::fs::remove_dir_all(self.wasm_bindgen_out_dir()); + // Remove the wasm dir if we packaged it to an "asset"-type app + if self.should_bundle_to_asset() { + _ = std::fs::remove_dir_all(self.wasm_bindgen_out_dir()); + } // Write the version file so we know what version of the optimizer we used std::fs::write(self.asset_optimizer_version_file(), crate::VERSION.as_str())?; @@ -3164,6 +3166,11 @@ impl BuildRequest { self.config.web.pre_compress & release } + /// Check if the wasm output should be bundled to an asset type app. + fn should_bundle_to_asset(&self) -> bool { + self.release && !self.wasm_split && self.platform == Platform::Web + } + /// Bundle the web app /// - Run wasm-bindgen /// - Bundle split @@ -3378,11 +3385,6 @@ impl BuildRequest { format!("wasm/{}", asset.file_name().unwrap().to_str().unwrap()) }; - // Remove the wasm dir if we packaged it to an "asset"-type app - if package_to_asset { - std::fs::remove_dir_all(&bindgen_outdir).context("Failed to remove bindgen outdir")?; - } - // Write the index.html file with the pre-configured contents we got from pre-rendering std::fs::write( self.root_dir().join("index.html"), diff --git a/packages/cli/src/cli/bundle.rs b/packages/cli/src/cli/bundle.rs index dd916441c..60b5932c6 100644 --- a/packages/cli/src/cli/bundle.rs +++ b/packages/cli/src/cli/bundle.rs @@ -35,12 +35,6 @@ pub struct Bundle { #[clap(long)] pub out_dir: Option, - /// Build the fullstack variant of this app, using that as the fileserver and backend - /// - /// This defaults to `false` but will be overridden to true if the `fullstack` feature is enabled. - #[clap(long)] - pub(crate) fullstack: bool, - /// Run the ssg config of the app and generate the files #[clap(long)] pub(crate) ssg: bool,