bevy_mod_scripting
bevy_mod_scripting copied to clipboard
Wasm compile error with rhai
Running trunk serve shows this doesn't seem to matter which features I use because I set default features false anyway and only use the rhai feature. Does bevy_mod_scripting rely on this bevy_asset feature?
2025-02-09T11:05:58.247667Z INFO 📦 starting build
Compiling bevy_asset v0.15.2
Compiling gilrs v0.11.0
Compiling accesskit_winit v0.23.1
Compiling bevy_state v0.15.2
error: The "file_watcher" feature for hot reloading does not work on Wasm.
Disable "file_watcher" when compiling to Wasm
--> /home/qat/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.15.2/src/io/mod.rs:2:1
|
2 | / compile_error!(
3 | | "The \"file_watcher\" feature for hot reloading does not work \
4 | | on Wasm.\nDisable \"file_watcher\" \
5 | | when compiling to Wasm"
6 | | );
| |_^
Compiling instant v0.1.13
Compiling thin-vec v0.2.13
Compiling rhai v1.21.0
error: could not compile `bevy_asset` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
2025-02-09T11:07:01.403243Z ERROR ❌ error
error from build pipeline
Caused by:
0: HTML build pipeline failed (1 errors), showing first
1: error from asset pipeline
2: running cargo build
3: error during cargo build execution
4: cargo call to executable 'cargo' with args: '["build", "--target=wasm32-unknown-unknown", "--manifest-path", "/h
ome/qat/tyconia/Cargo.toml"]' returned a bad status: exit status: 101
Hi yes WASM is not supported currently, and yes BMS core does depend on bevy_asset
this is tracked under #166
this is tracked under #166
I thought that issue pertains to mlua not having a wasm32-unknown-unknown target whilst this one is with rhai
Is this an upstream issue with bevy_asset or file watcher? I think I'm missing something
I thought that issue pertains to mlua not having a wasm32-unknown-unknown target whilst this one is with rhai
No you're right this is a different issue related to WASM support, what I mean is that this crate hasn't been tested against WASM at all, so I am lumping all of the issues together as a generic "compile for WASM" request.
Is this an upstream issue with bevy_asset or file watcher? I think I'm missing something
It looks like yes, file watcher cannot be enabled while compiling to WASM. However if BMS is enabling that flag, I do not plan on tackling WASM compat until after re-working doc-gen features, unless someone else has a look
FYI I was cleaning up bevy features, and looks like I'll be getting rid of that feature flag anyway in #316
I recently tried compiling for wasm and succeded with:
[package]
name = "test_consumer_crate"
version = "0.1.0"
edition = "2024"
[[bin]]
name = "test_consumer_crate"
path = "src/main.rs"
[dependencies]
bevy = { version = "0.16", default-features = false, features = [
"bevy_gltf",
"bevy_winit",
"bevy_render",
"png",
"web",
"webgpu",
] }
bevy_mod_scripting = { default-features = false, features = [
"rhai",
], path = "../../../../bevy_mod_scripting" }
[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"
With the current master (we disable default features completely now)
The only thing is that code generation will cause some build errors as it doesn't take targets into account yet (but you can disable the generated bindings)