Use EXPORT_ES6 setting and .mjs suffix#2273
Conversation
|
Amp - perhaps 6 and 7 which are docs but LGTM! PR Review: Use EXPORT_ES6 setting and .mjs suffixCommit: SummaryMigrates the AtomVM emscripten/WASM port from legacy CommonJS script loading to ES6 modules:
Verdict: ✅ LGTM with minor suggestionsThe core migration is correct. The Detailed Findings1. ✅ ES6 Module Pattern — CorrectThe Emscripten ES6 output's default export is a factory function. The pattern used across all HTML files: import AtomVM from "/AtomVM.mjs";
window.Module = await AtomVM({ arguments: [...] });is the correct browser-side instantiation pattern. Using 2. ✅
|
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
Future emsdk emits worker.js again |
Low | High (silent breakage) | CI assertion (suggestion #8) |
| Downstream users stuck on old integration | Medium | Medium | Better UPDATING.md (suggestion #6) |
| Symlink-based invocation fails | Low | Low | realpathSync hardening (suggestion #5) |
Files Reviewed
| File | Status |
|---|---|
src/platforms/emscripten/src/CMakeLists.txt |
✅ Correct |
src/platforms/emscripten/src/atomvm.extern-post.js |
|
.github/workflows/wasm-build.yaml |
✅ Complete |
CHANGELOG.md |
✅ Correct |
UPDATING.md |
|
doc/src/build-instructions.md |
|
doc/src/getting-started-guide.md |
✅ Correct |
examples/emscripten/*.html (6 files) |
✅ Consistent |
examples/emscripten/wasm_webserver.erl |
✅ Correct |
src/platforms/emscripten/tests/src/*.html (4 files) |
✅ Consistent |
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later