Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write how to use bevy_egui_inspector on web #196

Open
janhohenheim opened this issue Jul 27, 2024 · 3 comments
Open

Write how to use bevy_egui_inspector on web #196

janhohenheim opened this issue Jul 27, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@janhohenheim
Copy link
Member

janhohenheim commented Jul 27, 2024

Running trunk serve --features dev seems to ignore the features passed. I had to add the following to my index.html:

-    <link data-trunk rel="rust" data-cargo-no-default-features data-wasm-opt="s" href="../" />
+    <link data-trunk rel="rust" data-cargo-no-default-features data-cargo-features="dev" data-wasm-opt="s" href="../" />

but then I got greeted with the following:
image

it seems to me like there is no opt-out of that feature when using bevy_egui_inspector, which may be worth fixing upstream: jakobhellermann/bevy-inspector-egui#209 and jakobhellermann/bevy-inspector-egui#210. Until then, you indeed need to set your RUSTFLAGS env var:

RUSTFLAGS="--cfg=web_sys_unstable_apis"

I've seen people online say that you can add this to your config.toml, but I have not had success with that.


Technically we don't ship bevy_egui_inspector, but given that we highly recommend it, it may be worth making sure that people can actually use it.

@janhohenheim janhohenheim added this to the Bevy Jam 6 milestone Jul 27, 2024
@janhohenheim janhohenheim added the documentation Improvements or additions to documentation label Jul 27, 2024
@TheKnarf
Copy link

TheKnarf commented Aug 1, 2024

Add the following to to .cargo/config.toml:

[build]
rustflags = ["--cfg=web_sys_unstable_apis"]

I think this should probably just be a part of the template.

@janhohenheim
Copy link
Member Author

janhohenheim commented Aug 1, 2024

@TheKnarf I don't know why, but that does not work on my Windows environment. Note that my config.toml works in general, so that's not the issue. I really had to set the environment variable.

@TheKnarf
Copy link

TheKnarf commented Aug 2, 2024

Hm, I got it working on MacOS. I haven't tested it on windows, but it also worked in the CI pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants