@@ -47,11 +47,41 @@ The project uses a combined pipeline to compile the C++ core to Wasm and bundle
4747
4848| Command | Description |
4949| --- | --- |
50- | ` npm run build ` | Runs the full pipeline: Clean -> Build Wasm -> Compile TS -> Bundle Webpack. |
51- | ` npm run build:wasm ` | Compiles the C++ source code to WebAssembly using ` scripts/pipeline.sh ` . |
50+ | ` npm run build ` | Full release build: Clean → Build Wasm → Compile TS → Bundle Webpack. |
51+ | ` npm run build:debug ` | Full debug build (see below). |
52+ | ` npm run build:wasm ` | Compiles the C++ source to WebAssembly (release flags). |
53+ | ` npm run build:wasm:debug ` | Compiles the C++ source to WebAssembly (debug flags). |
5254| ` npm run build:js ` | Compiles TypeScript (` tsc ` ) and bundles assets (` webpack ` ). |
5355| ` npm run watch:types ` | Watches for TypeScript changes. |
5456
57+ ### Release vs Debug builds
58+
59+ By default all builds are ** release** builds: ` -O3 ` , LTO enabled, ` ASSERTIONS=0 ` , ` SAFE_HEAP=0 ` .
60+
61+ A ** debug** build swaps in the following flags for the WASM module:
62+
63+ | Flag | Release | Debug |
64+ | --- | --- | --- |
65+ | Optimisation | ` -O3 ` + ` -flto ` | ` -O0 -g ` |
66+ | Emscripten assertions | ` ASSERTIONS=0 ` | ` ASSERTIONS=2 ` |
67+ | Heap safety checks | ` SAFE_HEAP=0 ` | ` SAFE_HEAP=1 ` |
68+ | Stack overflow check | off | ` STACK_OVERFLOW_CHECK=2 ` |
69+ | Demangled stack traces | off | ` DEMANGLE_SUPPORT=1 ` |
70+ | C++ ` DEBUG ` macro | not defined | defined |
71+
72+ ``` bash
73+ # Full debug build (WASM + JS)
74+ npm run build:debug
75+
76+ # WASM only (faster iteration)
77+ npm run build:wasm:debug
78+
79+ # Or pass the env variable directly to the pipeline script
80+ PRIVMX_BUILD_TYPE=debug npm run build:wasm
81+ ```
82+
83+ > ** Note:** Debug builds are significantly larger and slower than release builds. Use them only for local development and troubleshooting.
84+
5585## Testing
5686
5787The project employs a dual testing strategy: ** Jest** for unit logic and ** Playwright** for End-to-End (E2E) integration testing.
0 commit comments