bevy_github_ci_template icon indicating copy to clipboard operation
bevy_github_ci_template copied to clipboard

Local web development option.

Open rparrett opened this issue 1 year ago • 2 comments

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.

rparrett avatar Aug 02 '22 19:08 rparrett

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

bardt avatar Nov 24 '22 14:11 bardt

That's great info to collect here.

I've been using cargo make in mine 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.

rparrett avatar Nov 24 '22 15:11 rparrett