When building with -sWASM_ESM_INTEGRATION and say -O3, there's a JS optimizer assertion failure.
Example:
emcc test/hello_world.c -sWASM_ESM_INTEGRATION -sEXPORT_ES6 -O3 -o out.mjs
Result:
AssertionError [ERR_ASSERTION]: could not find the assignment to "wasmImports".
perhaps --pre-js or --post-js code moved it out of the global scope? ...
at Object.<anonymous> (.../tools/acorn-optimizer.mjs:...) // emitDCEGraph
emcc: error: '... acorn-optimizer.mjs <tmp>.js emitDCEGraph --no-print --export-es6' failed (returned 1)
The issue is that wasmImports is gated out under WASM_ESM_INTEGRATION in src/preamble.js:718.
The metadce needs to either be disabled or somehow be taught the ESM integration graph I believe here.
When building with
-sWASM_ESM_INTEGRATIONand say-O3, there's a JS optimizer assertion failure.Example:
Result:
The issue is that
wasmImportsis gated out underWASM_ESM_INTEGRATIONin src/preamble.js:718.The metadce needs to either be disabled or somehow be taught the ESM integration graph I believe here.