Stream: jco

Topic: common js


view this post on Zulip Tyler Schoppe (Apr 04 2024 at 19:22):

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!

view this post on Zulip Guy Bedford (Apr 04 2024 at 21:36):

@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