bevy_image not available with bevy default-features=false
Bevy version
0.15.0
What you did
I am using Image and TextureFormatPixelInfo from bevy_image (respective bevy::image) and I want to only include only the relevant bevy parts by depending on bevy and setting deafult-features=false. rust-analyzer is suggesting the following import bevy::image::Image, but I get this error message when building:
error[E0432]: unresolved import `bevy::image`
--> src/asset_loader.rs:11:5
|
11 | image::{Image, TextureFormatPixelInfo},
| ^^^^^ could not find `image` in `bevy`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `bevy_titan` (lib) due to 1 previous error
What went wrong
I am not sure. There is no bevy_image feature, but I would have expected bevy_sprite (which is a feature I enable) to pull in bevy_image (and obviously I can still functionally use Image, just not directly because I can not import it). See https://github.com/KirmesBude/bevy_titan/commit/4c6477507261f9f4a746dbe030e648b3fea85576 for my specific reproducible issue.
Workaround: Enable any image feature e.g. "png"
+1, this blocks Hanabi.
The problem is that we didn't wire up the optional bevy_image dependency to the top level bevy crate. This should definitely be fixed in a patch release. There is a better workaround than forcing a feature like png. Just add a manual dependency on bevy_internal and set the optional feature there.
[dependencies]
bevy = { version = "0.15", default-features = false }
bevy_internal = { version = "0.15", features = [ "bevy_image" ]}