speed up incremental cli builds by making wasm-opt optional (#2720)
* speed up incremental builds by making wasm-opt optional
This commit is contained in:
1 parent
6558fd95a2
commit
8aa07b0a75
3 files changed
+12
-4
No files matched your search
@@ -98,7 +98,7 @@ jobs:
|
||||
checksum: sha256
|
||||
manifest_path: packages/cli/Cargo.toml
|
||||
ref: refs/tags/${{ env.RELEASE_POST }}
|
||||
|
||||
features: wasm-opt
|
||||
|
||||
# todo: these things
|
||||
# Run benchmarks, which we'll use to display on the website
|
||||
@@ -155,4 +155,3 @@ jobs:
|
||||
# - name: determine docs folder by channel
|
||||
# id: determine_docs_folder
|
||||
# run: echo "::set-output name=folder::$(echo ${{ github.event.inputs.channel }} | sed 's/v//g' | sed 's/\.x//g' | sed 's/main/nightly/g')"
|
||||
|
||||
@@ -100,7 +100,7 @@ env_logger = "0.11.3"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["std", "env-filter"] }
|
||||
console-subscriber = { version = "0.3.0", optional = true }
|
||||
tracing = { workspace = true }
|
||||
wasm-opt = "0.116.1"
|
||||
wasm-opt = { version = "0.116.1", optional = true }
|
||||
ratatui = { version = "0.27.0", features = ["crossterm", "unstable"] }
|
||||
crossterm = { version = "0.27.0", features = ["event-stream"] }
|
||||
ansi-to-tui = "=5.0.0-rc.1"
|
||||
@@ -118,6 +118,9 @@ default = []
|
||||
plugin = []
|
||||
tokio-console = ["dep:console-subscriber"]
|
||||
|
||||
# when releasing dioxus, we want to enable wasm-opt
|
||||
wasm-opt = ["dep:wasm-opt"]
|
||||
|
||||
[[bin]]
|
||||
path = "src/main.rs"
|
||||
name = "dx"
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::builder::progress::Stage;
|
||||
use crate::builder::progress::UpdateBuildProgress;
|
||||
use crate::builder::progress::UpdateStage;
|
||||
use crate::error::{Error, Result};
|
||||
use dioxus_cli_config::WasmOptLevel;
|
||||
use futures_channel::mpsc::UnboundedSender;
|
||||
use manganis_cli_support::AssetManifest;
|
||||
use std::path::Path;
|
||||
@@ -130,8 +129,14 @@ impl BuildRequest {
|
||||
// Run wasm-bindgen
|
||||
self.run_wasm_bindgen(&input_path, &bindgen_outdir).await?;
|
||||
|
||||
// Only run wasm-opt if the feature is enabled
|
||||
// Wasm-opt has an expensive build script that makes it annoying to keep enabled for iterative dev
|
||||
#[cfg(feature = "wasm-opt")]
|
||||
{
|
||||
// Run wasm-opt if this is a release build
|
||||
if self.build_arguments.release {
|
||||
use dioxus_cli_config::WasmOptLevel;
|
||||
|
||||
tracing::info!("Running optimization with wasm-opt...");
|
||||
let mut options = match self.dioxus_crate.dioxus_config.web.wasm_opt.level {
|
||||
WasmOptLevel::Z => {
|
||||
@@ -163,6 +168,7 @@ impl BuildRequest {
|
||||
(new_size as f64 - old_size as f64) / old_size as f64 * 100.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If pre-compressing is enabled, we can pre_compress the wasm-bindgen output
|
||||
let pre_compress = self
|
||||
|
||||
Reference in new issue
Block a user