Skip to content

bevy's bevy_ecs for macros path fails target arch specific dependency config #25278

Description

@bgkillas

Bevy version and features

  • git version c7a16115cd783e5db98acf9830f6293371ac066d, also v0.19.0, this is likely a rust bug but i do not feel like finding the minimal example in macros and is still relevent here
  • default features = false

[Optional] Relevant system information

If you cannot get Bevy to build or run on your machine, please include:

  • cargo 1.97.1 (c980f4866 2026-06-30)
  • arch linux

What you did

code being

use bevy::ecs::resource::Resource;
fn main() {}
#[derive(Resource)]
pub struct Foo;

fails with

[dependencies]

[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {git = "https://github.com/bevyengine/bevy", default-features = false}

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {git = "https://github.com/bevyengine/bevy", default-features = false}

giving error

error[E0433]: cannot find module or crate `bevy_ecs` in this scope
 --> src/main.rs:3:10
  |
3 | #[derive(Resource)]
  |          ^^^^^^^^ use of unresolved module or unlinked crate `bevy_ecs`
  |
  = help: if you wanted to use a crate named `bevy_ecs`, use `cargo add bevy_ecs` to add it to your `Cargo.toml`
  = note: this error originates in the derive macro `Resource` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0433`.
error: could not compile `bevy_test` (bin "bevy_test") due to 1 previous error

but does not fail with

[dependencies]
bevy = {git = "https://github.com/bevyengine/bevy", default-features = false}

or v0.19.0 bevy version

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions