Replies: 1 comment 2 replies
-
Thanks for the feedback. There are efforts underway to try to improve the ES6 modules that we generate. There was an RFC that went out a while back on the mailing list: https://groups.google.com/d/msgid/emscripten-discuss/dc8c4405-60ae-4c02-9bf4-92c89408f48an%40googlegroups.com?utm_medium=email&utm_source=footer There is a related google doc: https://docs.google.com/document/d/1ccH3NsRQgEc1HXWI_IFAnMbTM0Vn1lP_EhJmdLRzYvs. As well as github "project" for this topic: https://github.com/orgs/emscripten-core/projects/2 One piece of this work has already landed in the form of the new/experimental Regarding removing duplication between for programs that include multiple emscirpten-generated modules, that is complicated by the fact that all of the emscripten-generated JS functions are closures over a lot of global state. Each function assumes that it has access to a lot of module-specific globals. e.g. wasmImports, wasmMemory, HEAPU8, etc, etc. |
Beta Was this translation helpful? Give feedback.
-
According to the documentation for
emcc -o
, specifying an output with.mjs
outputs an ES module:However, the output is not an ES module, it is an Immediately Invoked Function Expression, and quite an ugly one at that:
I think it would make a lot more sense to actually use ES modules under the hood in this case. This would support JS JIT optimizations better, in addition to much cleaner syntax. Moreover, I find that when compiling GNU coreutils, I get significant code duplication (over 25,000 lines).
I am very interested in the possibility of de-duplicating Emscripten code— perhaps with a proper package or module(s). This wouldn't be easy, and I can't guarantee that I would be able to work on a PR.
Beta Was this translation helpful? Give feedback.
All reactions