From c5bf525547ae23e1a4d4e406144ae43c6033bd54 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 1 Mar 2023 09:09:30 -0600 Subject: [PATCH] fix reloading non rust files when hot reloading is enabled --- src/server/mod.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/server/mod.rs b/src/server/mod.rs index 5ac8b6997..7a8325d6e 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -182,8 +182,26 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig) -> R if let Ok(evt) = evt { let mut messages: Vec> = Vec::new(); for path in evt.paths.clone() { + // if this is not a rust file, rebuild the whole project if path.extension().and_then(|p| p.to_str()) != Some("rs") { - continue; + match build_manager.rebuild() { + Ok(res) => { + print_console_info( + &watcher_ip, + port, + &config, + PrettierOptions { + changed: evt.paths, + warnings: res.warnings, + elapsed_time: res.elapsed_time, + }, + ); + } + Err(err) => { + log::error!("{}", err); + } + } + return; } // find changes to the rsx in the file let mut map = file_map.lock().unwrap();