cargo-web icon indicating copy to clipboard operation
cargo-web copied to clipboard

Support custom wasm paths

Open matprec opened this issue 6 years ago • 3 comments

The generated wasm loader will only load wasm files relative to the html page. This is a problem if the wasm file is in a static directory (mysite.app/static_path/awesome.wasm), served by a third party framework. Currently i have to manually adjust the path to prepend '/static_path/' in the generated file here.

I'd propose to make this path configurable in Web.toml.

matprec avatar Feb 23 '18 08:02 matprec

This might also solve some problems I've had with Chrome Extensions, so this gets a big :+1: from me.

Pauan avatar Feb 23 '18 08:02 Pauan

This was something I did plan to add, but not WASM-specific - you'd set the path in your Web.toml to where your .js file would be generated (e.g. with cargo deploy) and served from with the implication that the .wasm file would be right next to it on non-asmjs targets.

Would that work for you?

koute avatar Feb 23 '18 15:02 koute

If you mean that the wasm file will be loaded from the same absolute path, then yes!

matprec avatar Feb 23 '18 15:02 matprec