Skip to content

Fix dx bundle and release web builds #4211

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

Merged
merged 2 commits into from
May 30, 2025
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
16 changes: 9 additions & 7 deletions packages/cli/src/build/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
Expand Down Expand Up @@ -3163,6 +3165,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
Expand Down Expand Up @@ -3377,11 +3384,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"),
Expand Down
6 changes: 0 additions & 6 deletions packages/cli/src/cli/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ pub struct Bundle {
#[clap(long)]
pub out_dir: Option<PathBuf>,

/// 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,
Expand Down
Loading