feat: turn on compiler optimizations for the wasm

This commit is contained in:
Jet Pham 2026-03-05 00:26:21 -08:00
parent 7b726be760
commit 3364a6ae9b
No known key found for this signature in database
3 changed files with 21 additions and 12 deletions

View file

@ -1,2 +1,8 @@
[build]
target = "wasm32-unknown-unknown"
[target.wasm32-unknown-unknown]
rustflags = ["-C", "link-arg=--strip-all"]
[unstable]
build-std = ["core", "alloc", "std", "panic_abort"]

View file

@ -1,3 +1,5 @@
cargo-features = ["panic-immediate-abort"]
[package]
name = "cgol"
version = "0.1.0"
@ -5,16 +7,12 @@ authors = ["jet"]
edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["console_error_panic_hook"]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "0.2"
js-sys = "0.3"
web-sys = { version = "0.3", features = [
"console",
"CanvasRenderingContext2d",
"Document",
"HtmlCanvasElement",
@ -23,23 +21,28 @@ web-sys = { version = "0.3", features = [
"Element",
"EventTarget",
"Performance",
"DomRect",
"TouchEvent",
"Touch",
"TouchList",
"ImageData",
] }
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1", optional = true }
[features]
default = ["console_error_panic_hook"]
[dev-dependencies]
wasm-bindgen-test = "0.3"
[package.metadata.wasm-pack.profile.release]
wasm-opt = false
[profile.dev]
debug = "line-tables-only"
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
panic = "immediate-abort"
strip = true