Release hardening: no symbols, no source maps, no wasm names
ci / rust (push) Successful in 7m1s
ci / typescript (push) Successful in 7m36s

Rust release profiles strip symbols and debug info (desktop: fat LTO, panic=abort), the web app and site ship
without source maps, and wasm-opt drops debug, producer and name sections from the engine.

Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
This commit is contained in:
spark committed 2026-10-12 16:13:37 +01:00
1 parent 1e6a198c89
commit adb557290c
5 files changed
+21 -2

No files matched your search

+6
View File
@@ -20,6 +20,12 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
# Server workers and the base of every other profile: no symbols or debug info in what ships.
[profile.release]
lto = "thin"
strip = true
debug = false
# The browser module: small and fast enough for slider drags (same trade-off as LightCraft's `web` profile).
[profile.wasm]
inherits = "release"
+2 -1
View File
@@ -7,6 +7,7 @@ export default defineConfig({
plugins: [react(), tailwindcss()],
clearScreen: false,
server: { port: 5173, strictPort: true },
build: { target: "es2022", sourcemap: true },
// No source maps in production: the browser gets minified code only, never the readable sources.
build: { target: "es2022", sourcemap: false },
test: { environment: "jsdom", setupFiles: ["./src/test-setup.ts"] },
});
+10
View File
@@ -17,3 +17,13 @@ tauri = { version = "2", features = [] }
tauri-plugin-opener = "2"
keyring = { version = "3", features = ["apple-native", "windows-native", "sync-secret-service", "crypto-rust"] }
serde = { version = "1", features = ["derive"] }
# Release builds: no symbols or debug info, whole-program optimisation, no unwinding tables. The binary only tells
# a disassembler what machine code does, not what the functions were called.
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1
panic = "abort"
strip = true
debug = false
+1
View File
@@ -9,6 +9,7 @@ const api = process.env.API_URL ?? "http://localhost:3000";
const config: NextConfig = {
reactStrictMode: true,
poweredByHeader: false,
productionBrowserSourceMaps: false,
async rewrites() {
return [{ source: "/v1/:path*", destination: `${api}/v1/:path*` }];
},
+2 -1
View File
@@ -11,5 +11,6 @@ have="$(wasm-bindgen --version 2>/dev/null | awk '{print $2}')"
cargo build --locked --profile wasm --target wasm32-unknown-unknown -p photoreport-engine-wasm
rm -rf "$OUT"
wasm-bindgen --target web --no-typescript --out-dir "$OUT" target/wasm32-unknown-unknown/wasm/photoreport_engine_wasm.wasm
if command -v wasm-opt >/dev/null 2>&1; then wasm-opt -O3 --enable-bulk-memory --enable-nontrapping-float-to-int -o "$OUT/photoreport_engine_wasm_bg.wasm" "$OUT/photoreport_engine_wasm_bg.wasm"; fi
# wasm-opt also drops the function-name section (no -g), so the module carries no internal names.
if command -v wasm-opt >/dev/null 2>&1; then wasm-opt -O3 --strip-debug --strip-producers --enable-bulk-memory --enable-nontrapping-float-to-int -o "$OUT/photoreport_engine_wasm_bg.wasm" "$OUT/photoreport_engine_wasm_bg.wasm"; fi
ls -l "$OUT"