ceifa / wasmoon

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

Unsecure request to glue.wasm #51

Closed Drumsin closed 2 years ago

Drumsin commented 2 years ago

Why does this make a request here? What does this do? Do I have to make this request? It's not secure.

node_modules/wasmoon/dist this.customWasmUri = 'http://unpkg.com/wasmoon/dist/glue.wasm';

Thank you

Drumsin commented 2 years ago

Found that there is customWasmUri param. Is there a way I can run this locally with webpack and without a server? I'm getting cross site scripting security errors if I point it locally to my file system.

ceifa commented 2 years ago

The glue.wasm file it's necessary because it is basically the lua engine compiled to webassembly. If you want to host it by yourself with webpack, you can check my project that does exactly this: https://github.com/ceifa/try-lua

Drumsin commented 2 years ago

Thanks for the quick response and example. This is exactly what I needed, thank you for building a great tool.

Drumsin commented 2 years ago

I changed my code like how you set yours up with import. No way around making an xhr request for glue.wasm?

My goal is to open my dist/index.html locally on my file system without a web server and have it work, but I get CORS blocking for the glue.wasm even though it's on the same system locally.

ceifa commented 2 years ago

@Drumsin I'm not sure if that is possible, maybe you can try something like the ffmpeg solution: https://github.com/ffmpegwasm/ffmpeg.wasm/blob/master/src/browser/getCreateFFmpegCore.js

Another possible solution is to preload the wasm file as a data URL with webpack and create a blob URL from it.