Skip to content

Allow using bevy lint web #433

@janhohenheim

Description

@janhohenheim

By now, I heavily use the [package.metadata.bevy_cli] config:

[package.metadata.bevy_cli]
default-features = false

[package.metadata.bevy_cli.native]
features = ["native"]

[package.metadata.bevy_cli.native.dev]
features = ["dev_native"]

[package.metadata.bevy_cli.web]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

[package.metadata.bevy_cli.web.dev]
features = ["dev"]

[package.metadata.bevy_cli.web.release]
# Optimize with size in mind (also try "z", sometimes it is better).
# Slightly slows compile times, great improvements to file size and runtime performance.
opt-level = "s"
# Strip all debugging information from the binary to slightly reduce file size.
strip = "debuginfo"
panic = "abort"
lto = true

Being able to use bevy run and bevy run web and have all of these set automatically is great! But unfortunately, there is currently no easy way to verify web builds just as nicely in CI runners. bevy test web (#397) would solve this, but until then, we have this call in bevy_new_2d:

cargo check --config 'profile.web.inherits="dev"' --features dev --no-default-features --profile web --target wasm32-unknown-unknown

That's quite verbose. I then thought about

bevy check web

until @TimJentzsch pointed out that that would be nearly identical to

bevy lint web

which would be even better, as code paths that are exclusive to web builds are currently hidden from bevy lint if not passing the big boilerplate above to it as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinterRelated to the linter and custom lintsA-WebBuilding or running Bevy apps targeting the browserC-FeatureMake something new possible

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions