bevy/tools
oracle58 d7cab93495
Add debug build option to build-wasm-example (#19312)
## Objective

- Add a `--debug` flag to `build-wasm-example` to support debug builds
for WebGL2/WebGPU targets.
- Fixes #18464

## Solution
- Added `--debug` flag to build Wasm examples in debug mode.
- Default remains release mode if `--debug` is not specified.
- Updated documentation to describe the new flag and usage.

## Testing
- Verified debug and release builds for WebGL2 and WebGPU respectively.
- Confirmed wasm artifacts are placed in the correct target dir for each
build profile:
  - Debug: `target/wasm32-unknown-unknown/debug/examples/`
  - Release: `target/wasm32-unknown-unknown/release/examples/`
- Confirmed wasm-bindgen output is written to:
`examples/wasm/target/debug` , `examples/wasm/target/release`
- Haven't actually tested running the example

| Backend | Profile | Artifacts written | Build success    |
|---------|---------|-------------------|------------------|
| webgl2 | debug | ✓ | ✓ |
| webgl2 | release | ✓ | ✓ |
| webpgu | debug | ✓ | ✓ |
| webpgu | release | ✓ | ✓ |

### Examples

**Debug**
```
$ cargo run -p build-wasm-example -- --api webgl2 --debug load_gltf
```
```
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 02s
wasm-bindgen --out-dir examples/wasm/target/debug --out-name wasm_example --target web target/wasm32-unknown-unknown/debug/examples/load_gltf.wasm
```

**Release**
```
$ cargo run -p build-wasm-example -- --api webgl2 load_gltf`
```
```
Finished `release` profile [optimized] target(s) in 1m 08s
wasm-bindgen --out-dir examples/wasm/target/release --out-name wasm_example --target web target/wasm32-unknown-unknown/release/examples/load_gltf.wasm
```

---------

Co-authored-by: Rob Parrett <robparrett@gmail.com>
2025-05-24 01:43:57 +00:00
..
build-easefunction-graphs Add print_stdout and print_stderr lints (#17446) (#18233) 2025-03-11 19:35:48 +00:00
build-templated-pages Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
build-wasm-example Add debug build option to build-wasm-example (#19312) 2025-05-24 01:43:57 +00:00
ci Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
compile_fail_utils Fix compilation of compile_fail_utils when not using rustup (#18394) 2025-03-30 02:33:03 +00:00
example-showcase Split example file docblock and code when generating web examples markdown (#18191) 2025-03-19 20:01:37 +00:00
publish.sh don't wait during publishing (#18563) 2025-03-26 21:27:29 +00:00