added hot-reload as config option with default to true (#2024)
This commit is contained in:
1 parent
ac990a4447
commit
8eda67ecb2
4 files changed
+16
-1
No files matched your search
@@ -14,6 +14,9 @@ out_dir = "dist"
|
|||||||
# resource (static) file folder
|
# resource (static) file folder
|
||||||
asset_dir = "public"
|
asset_dir = "public"
|
||||||
|
|
||||||
|
# hot reload by default
|
||||||
|
hot_reload = true
|
||||||
|
|
||||||
[web.app]
|
[web.app]
|
||||||
|
|
||||||
# HTML title tag content
|
# HTML title tag content
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ impl Default for DioxusConfig {
|
|||||||
default_platform: default_platform(),
|
default_platform: default_platform(),
|
||||||
out_dir: out_dir_default(),
|
out_dir: out_dir_default(),
|
||||||
asset_dir: asset_dir_default(),
|
asset_dir: asset_dir_default(),
|
||||||
|
hot_reload: hot_reload_default(),
|
||||||
|
|
||||||
#[cfg(feature = "cli")]
|
#[cfg(feature = "cli")]
|
||||||
tools: Default::default(),
|
tools: Default::default(),
|
||||||
@@ -226,6 +227,9 @@ pub struct ApplicationConfig {
|
|||||||
#[serde(default = "asset_dir_default")]
|
#[serde(default = "asset_dir_default")]
|
||||||
pub asset_dir: PathBuf,
|
pub asset_dir: PathBuf,
|
||||||
|
|
||||||
|
#[serde(default = "hot_reload_default")]
|
||||||
|
pub hot_reload: bool,
|
||||||
|
|
||||||
#[cfg(feature = "cli")]
|
#[cfg(feature = "cli")]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub tools: std::collections::HashMap<String, toml::Value>,
|
pub tools: std::collections::HashMap<String, toml::Value>,
|
||||||
@@ -242,6 +246,10 @@ fn default_platform() -> Platform {
|
|||||||
Platform::Web
|
Platform::Web
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn hot_reload_default() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
fn asset_dir_default() -> PathBuf {
|
fn asset_dir_default() -> PathBuf {
|
||||||
PathBuf::from("public")
|
PathBuf::from("public")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ out_dir = "dist"
|
|||||||
# resource (static) file folder
|
# resource (static) file folder
|
||||||
asset_dir = "public"
|
asset_dir = "public"
|
||||||
|
|
||||||
|
# hot reload by default
|
||||||
|
hot_reload = true
|
||||||
|
|
||||||
[web.app]
|
[web.app]
|
||||||
|
|
||||||
# HTML title tag content
|
# HTML title tag content
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ impl Serve {
|
|||||||
let serve_cfg = self.serve.clone();
|
let serve_cfg = self.serve.clone();
|
||||||
|
|
||||||
// change the relase state.
|
// change the relase state.
|
||||||
crate_config.with_hot_reload(self.serve.hot_reload);
|
let hot_reload = self.serve.hot_reload || crate_config.dioxus_config.application.hot_reload;
|
||||||
|
crate_config.with_hot_reload(hot_reload);
|
||||||
crate_config.with_cross_origin_policy(self.serve.cross_origin_policy);
|
crate_config.with_cross_origin_policy(self.serve.cross_origin_policy);
|
||||||
crate_config.with_release(self.serve.release);
|
crate_config.with_release(self.serve.release);
|
||||||
crate_config.with_verbose(self.serve.verbose);
|
crate_config.with_verbose(self.serve.verbose);
|
||||||
|
|||||||
Reference in new issue
Block a user