rive-react icon indicating copy to clipboard operation
rive-react copied to clipboard

Expose `RuntimeLoader`'s WASM file

Open slin12 opened this issue 1 year ago • 1 comments

Hi,

I've read your docs on how to preload the WASM file, and they are very useful if you're looking to in-line the WASM file. Unfortunately, the added bundle size is a tradeoff I'm currently unable to make.

We are currently preloading the unpkg url directly, ie by adding a preload link in the head like so:

The issue is that this url changes often when the @rive-app/react-canvas is updated, which breaks this prefetching. Is there any way to expose the current URL, so that we can dynamically generate the preload link and no manual work is necessary in order to ensure we are preloading the correct URL?

I see that on RuntimeLoader there is a private wasmURL - is that something that could be exposed upstream?

Alternatively we are also looking into self-hosting the WASM, but we also run into the issue of the ensuring the WASM file is up to date with the current Rive package version.

Thank you!

slin12 avatar Sep 18 '24 17:09 slin12

Hi @slin12 , great suggestion, we'll expose this.

HayesGordon avatar Sep 19 '24 08:09 HayesGordon

This has been exposed as getWasmUrl in RuntimeLoader. Closing this, but let us know if you run into issues.

HayesGordon avatar Dec 18 '24 09:12 HayesGordon