Fix wasm builds

This commit is contained in:
Piotr Siuszko 2025-10-13 10:37:31 +02:00
parent 76fda46111
commit dd1a60aa4f
4 changed files with 8 additions and 10 deletions

View File

@ -13,13 +13,6 @@ on:
# types:
# - published
env:
# --cfg=web_sys_unstable_apis is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: -D warnings --cfg=web_sys_unstable_apis -C target-feature=+bulk-memory
RUSTDOCFLAGS: -D warnings
permissions:
contents: write # for committing to gh-pages branch.

View File

@ -3,4 +3,4 @@
# check status at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
# we don't use `[build]` because of rust analyzer's build cache invalidation https://github.com/emilk/eframe_template/issues/93
[target.wasm32-unknown-unknown]
rustflags = ["--cfg=web_sys_unstable_apis"]
rustflags = ["--cfg=web_sys_unstable_apis"]

View File

@ -13,7 +13,12 @@
<title>rPack</title>
<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->
<link data-trunk rel="rust" data-wasm-opt="2" />
<link
data-trunk
rel="rust"
data-wasm-opt="3"
data-wasm-opt-params="--enable-bulk-memory --enable-nontrapping-float-to-int"
/>
<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
<base data-trunk-public-url />

View File

@ -12,4 +12,4 @@ create_mac_installer: bundle
# Create the installer using cargo-bundler
bundle:
cargo bundler -r
cargo bundler -r {{format_bundle}}