diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index 9f659b79c9ad2..eb5e2ce6a298a 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -38,7 +38,6 @@ parking_lot = { version = "0.12", features = ["arc_lock", "send_guard"] } ron = "0.8" serde = { version = "1", features = ["derive"] } thiserror = "1.0" -notify-debouncer-full = { version = "0.3.1", optional = true } [target.'cfg(target_os = "android")'.dependencies] bevy_winit = { path = "../bevy_winit", version = "0.12.0" } @@ -49,5 +48,8 @@ web-sys = { version = "0.3", features = ["Request", "Window", "Response"] } wasm-bindgen-futures = "0.4" js-sys = "0.3" +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +notify-debouncer-full = { version = "0.3.1", optional = true } + [dev-dependencies] bevy_core = { path = "../bevy_core", version = "0.12.0" } diff --git a/crates/bevy_asset/src/io/embedded/mod.rs b/crates/bevy_asset/src/io/embedded/mod.rs index f6620b3e69cec..58ef0157b8b10 100644 --- a/crates/bevy_asset/src/io/embedded/mod.rs +++ b/crates/bevy_asset/src/io/embedded/mod.rs @@ -1,7 +1,7 @@ -#[cfg(feature = "embedded_watcher")] +#[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] mod embedded_watcher; -#[cfg(feature = "embedded_watcher")] +#[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] pub use embedded_watcher::*; use crate::io::{ @@ -21,7 +21,7 @@ pub const EMBEDDED: &str = "embedded"; #[derive(Resource, Default)] pub struct EmbeddedAssetRegistry { dir: Dir, - #[cfg(feature = "embedded_watcher")] + #[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] root_paths: std::sync::Arc< parking_lot::RwLock>, >, @@ -34,7 +34,7 @@ impl EmbeddedAssetRegistry { /// or a [`Vec`]. #[allow(unused)] pub fn insert_asset(&self, full_path: PathBuf, asset_path: &Path, value: impl Into) { - #[cfg(feature = "embedded_watcher")] + #[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] self.root_paths .write() .insert(full_path.to_owned(), asset_path.to_owned()); @@ -47,7 +47,7 @@ impl EmbeddedAssetRegistry { /// or a [`Vec`]. #[allow(unused)] pub fn insert_meta(&self, full_path: &Path, asset_path: &Path, value: impl Into) { - #[cfg(feature = "embedded_watcher")] + #[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] self.root_paths .write() .insert(full_path.to_owned(), asset_path.to_owned()); @@ -68,7 +68,7 @@ impl EmbeddedAssetRegistry { }) }); - #[cfg(feature = "embedded_watcher")] + #[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] { let root_paths = self.root_paths.clone(); let dir = self.dir.clone(); @@ -196,7 +196,7 @@ macro_rules! embedded_asset { .world .resource_mut::<$crate::io::embedded::EmbeddedAssetRegistry>(); let path = $crate::embedded_path!($source_path, $path); - #[cfg(feature = "embedded_watcher")] + #[cfg(all(feature = "embedded_watcher", not(target_arch = "wasm32")))] let full_path = std::path::Path::new(file!()).parent().unwrap().join($path); #[cfg(not(feature = "embedded_watcher"))] let full_path = std::path::PathBuf::new(); diff --git a/crates/bevy_asset/src/io/file/mod.rs b/crates/bevy_asset/src/io/file/mod.rs index aae016df3bf1d..b65873b710d33 100644 --- a/crates/bevy_asset/src/io/file/mod.rs +++ b/crates/bevy_asset/src/io/file/mod.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "file_watcher")] +#[cfg(all(feature = "file_watcher", not(target_arch = "wasm32")))] mod file_watcher; #[cfg(feature = "multi-threaded")] @@ -6,7 +6,7 @@ mod file_asset; #[cfg(not(feature = "multi-threaded"))] mod sync_file_asset; -#[cfg(feature = "file_watcher")] +#[cfg(all(feature = "file_watcher", not(target_arch = "wasm32")))] pub use file_watcher::*; use std::{