ceifa / wasmoon

A real lua 5.4 VM with JS bindings made with webassembly
MIT License
462 stars 27 forks source link

Add option to embedd Wasm module #60

Closed matklad closed 1 year ago

matklad commented 1 year ago

At the moment, the Wasm module for lua vm needs to be fetched from the internet. This works nicely in the browser (just another package to fetch), but for server side it would be beneficial if the library was self-contained.

as far as I understand, the best way to do that would be to embedd a base64 encoded module as a sting in source file. That’s, for example, how deno implements deno-dom:

https://github.com/b-fuze/deno-dom/blob/e18ab07fd6e23f1e32ffd77fb4c0f92fadb81b87/build/deno-wasm/deno-wasm.js#L175

ceifa commented 1 year ago

It doesn't fetch from the internet on server side, the wasm module is exported as a separated file inside the package