bevyengine / bevy_github_ci_template

Apache License 2.0
202 stars 45 forks source link

Local web development option. #8

Open rparrett opened 2 years ago

rparrett commented 2 years ago

It would be great to have some instructions or scripts or something for users to easily do local testing/development for the web.

There are a bunch of ways to break a web build and the feedback loop could be substantially shortened.

bardt commented 1 year ago

In my project, I made a .justfile with something like this:

default: run

build-wasm:
    cargo build --release --target wasm32-unknown-unknown --no-default-features
    wasm-bindgen --no-typescript --out-name bevy_game --out-dir wasm --target web target/wasm32-unknown-unknown/release/my_game.wasm
    cp -r assets wasm/

run: build-wasm
    sfz ./wasm

It runs the same commands as in CI, and I can do $ just run to build for WASM and start local server

rparrett commented 1 year ago

That's great info to collect here.

I've been using cargo make in mine (example) to do something similar. It's sort of nice because you can write the tasks in cross-platform "duckscript." and it has some built-ins for ensuring crates like wasm-bindgen and a local dev server are installed.

We could also recommend wasm-server-runner, but I'm not a fan of that here because it uses its own separate index.html and there's no way to change that as far as I can tell.

I think the main reason this hasn't been done in-repo is that there are a lot of options.

janhohenheim commented 3 months ago

To throw another option into the room, bevy_quickstart is using trunk. We're pretty happy with it, but it comes with the caveat that it does not accept any custom profiles.