Skip to content

Commit a670d3a

Browse files
authored
fix(cli.rs): check if distDir exists after running beforeDevCommand (#1586)
1 parent 99307d0 commit a670d3a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.changes/cli-rs-dist-validation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cli.rs": patch
3+
---
4+
5+
Check if distDir assets are built after running `beforeDevCommand`.

tooling/cli.rs/src/build.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ impl Build {
6464
let config_guard = config.lock().unwrap();
6565
let config_ = config_guard.as_ref().unwrap();
6666

67-
let web_asset_path = PathBuf::from(&config_.build.dist_dir);
68-
if !web_asset_path.exists() {
69-
return Err(anyhow::anyhow!(
70-
"Unable to find your web assets, did you forget to build your web app? Your distDir is set to \"{:?}\".",
71-
web_asset_path
72-
));
73-
}
74-
7567
if let Some(before_build) = &config_.build.before_build_command {
7668
if !before_build.is_empty() {
7769
logger.log(format!("Running `{}`", before_build));
@@ -92,6 +84,14 @@ impl Build {
9284
}
9385
}
9486

87+
let web_asset_path = PathBuf::from(&config_.build.dist_dir);
88+
if !web_asset_path.exists() {
89+
return Err(anyhow::anyhow!(
90+
"Unable to find your web assets, did you forget to build your web app? Your distDir is set to \"{:?}\".",
91+
web_asset_path
92+
));
93+
}
94+
9595
rust::build_project(self.debug)?;
9696

9797
let app_settings = rust::AppSettings::new(&config_)?;

0 commit comments

Comments
 (0)