Any plans to support common js modules natively? Working on bringing some wasm components into a legacy node monolith and it would be great to have. Can make it work as is but feels a touch roundabout with dynamic import. Understand if not. Thanks!
@Tyler Schoppe we will probably be sticking with ESM as that's the primary embedding we need to be thinking about, and supporting two different embeddings may be a bit much from a maintenance point of view. That said, applying Babel can work to convert a component JS to commonjs, both for instantiation mode and normal mode. The tricky thing mainly is more that preview2-shim for any of the WASI builtins is itself an ESM embedding which would need to be reimplemented on CommonJS. Another option might be Node's new require(esm) support under --experimental-require-module
which is coming in the next release.
Last updated: Nov 22 2024 at 16:03 UTC