fix(web): silence spurious console errors (meta + AudioContext)
Two independent sources of noise in the web console, both from the default plugin set: 1. 'Failed to deserialize meta for asset shaders/*.wgsl' DefaultPlugins adds AssetPlugin with meta_check = Always, so bevy fetches <path>.meta for every shader. The shaders ship raw (no .meta files); on the trunk dev server those requests don't return a clean 404 that bevy maps to NotFound, so bevy receives bytes and tries to RON-deserialize them as AssetMetaMinimal, logging a SpannedError per shader. Set meta_check = Never: it skips the meta lookup and uses the loader's default meta — correct for processor-free raw assets. 2. 'AudioContext was not allowed to start' The default AudioPlugin opens a WebAudio sink at startup; browsers block that until a user gesture and log it as a JS error. This app has no audio, so disable AudioPlugin entirely — removes the noise and shrinks the wasm binary.
This commit is contained in:
parent
30786eb253
commit
00aa27175e
24
src/main.rs
24
src/main.rs
@ -21,7 +21,9 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
.add_plugins(
|
||||||
|
DefaultPlugins
|
||||||
|
.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
title: "singularity-rs".into(),
|
title: "singularity-rs".into(),
|
||||||
// On web, make the canvas track the browser window size.
|
// On web, make the canvas track the browser window size.
|
||||||
@ -29,7 +31,25 @@ fn main() {
|
|||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
..default()
|
..default()
|
||||||
}))
|
})
|
||||||
|
// The shaders ship as raw `.wgsl` files with no companion
|
||||||
|
// `.meta` files. The default `AssetMetaCheck::Always` makes bevy
|
||||||
|
// fetch `<path>.meta` for every asset; on the web dev server
|
||||||
|
// those requests don't return a clean 404, so bevy receives
|
||||||
|
// bytes it tries to RON-deserialize as `AssetMetaMinimal` and
|
||||||
|
// logs a deserialization error per shader. `Never` skips the
|
||||||
|
// meta lookup entirely and uses the loader's default meta —
|
||||||
|
// exactly right for processor-free assets.
|
||||||
|
.set(AssetPlugin {
|
||||||
|
meta_check: bevy::asset::AssetMetaCheck::Never,
|
||||||
|
..default()
|
||||||
|
})
|
||||||
|
// The app has no audio. The default AudioPlugin opens a WebAudio
|
||||||
|
// sink at startup, which browsers block until a user gesture and
|
||||||
|
// log as a noisy "AudioContext was not allowed to start" error.
|
||||||
|
// Dropping it removes that noise and shrinks the wasm binary.
|
||||||
|
.disable::<bevy::audio::AudioPlugin>(),
|
||||||
|
)
|
||||||
.add_plugins(render::BlackHolePlugin)
|
.add_plugins(render::BlackHolePlugin)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user