emscripten-core / emscripten-core/emscripten
[Feature Request] Declarative imports using ESM Implementation proposal
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Related to #5828.
The [esm integration proposal for Webassembly](https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration) is at stage 2 and appears to include a [declarative API for importing `.wasm` files](https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration#improve-ergonomics-of-webassembly-module-instantiation).
Webpack has [experimental support](https://webpack.js.org/configuration/experiments/) for this updated specification; as does [Node 19](https://nodejs.org/api/esm.html#wasm-modules).
Given this; I would like to request an opt-in feature for emscripten to use declarative loading rather than [this `locateFile` and `fetch` logic](https://github.com/emscripten-core/emscripten/blob/f80f0f9c7686c3a907594fb677245b3d208d4f90/src/preamble.js#L633-L646) which can [cause headaches when trying to create builds that are isomorphic across node and browser environments](https://github.com/rla/npm-swipl-wasm/issues/1).
Contributor guide
Assessment
This issue has not been assessed yet.