question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rive.wasm blocking website load

See original GitHub issue

I am currently developing a Gatsby website that uses a few Rive animations with the help of rive-react.

In development it works great, however whenever building my website the loading speeds for the first paint get very slow.

I noticed that a 3rd party request to get rive.wasm is what is blocking my website. I am attaching some screenshots below.

Do you have any advice how I can make the request faster? Is it possible to host the rive.wasm file e.g. on my own server?

Any help is appreciated!

Here is the request summary, which shows it took 93ms to get the rive file: Screenshot 2022-06-15 at 11 40 09

These are the request details: Screenshot 2022-06-15 at 11 41 00

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zplatacommented, Jul 1, 2022

Actually, you might be able to host the WASM file on your own server and be able to serve this up!

import Rive, { RuntimeLoader } from "@rive-app/react-canvas";

RuntimeLoader.setWasmUrl("http://your-own-server.com/rive.wasm");

function App() {
  return (
    <div>
      <Rive src="https://cdn.rive.app/animations/vehicles.riv" />
    </div>
  );
}

We can work on making the URL you’d like to set as a param you pass into <Rive> or useRive() but you could do this in the meantime, and then it shouldn’t try to request the wasm from unpkg by default.

To download the correlated WASM file for your server, check out the dependency version of @rive-app/canvas in the tagged version of @rive-app/react-canvas you’re consuming. For example, 1.0.71: https://github.com/rive-app/rive-react/blob/v3.0.15/package.json#L32

The correlated WASM file should be the following URL with the version identified above:

https://unpkg.com/@rive-app/canvas@1.0.71/rive.wasm

@carolinmaisenbacher @3lonious

0reactions
carolinmaisenbachercommented, Jul 11, 2022

Thank you for your detailed reply @zplata! Your solution of setting the wasm url with setWasmUrl worked flawlessly for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - Rive Guide
I have Content-Security-Policy set to block unsafe-eval, and now Rive fails to load. What do I do? ... Our Web (JS) runtime is...
Read more >
Failures against Content Security Policy of your site blocks the ...
Hi, I'm noticing that the .js main application created through emscripten/wasm is blocked by chrome when using "Content-Security-Policy", ...
Read more >
The dark side of WebAssembly - Virus Bulletin
In this paper we will walk through some of the instances in which Wasm can be used maliciously, such as: Tech support scams:...
Read more >
Rust and WebAssembly
wasm -game-of-life/www/index.html. This is the root HTML file for the Web page. It doesn't do much other than load bootstrap.js , ...
Read more >
Blocked - Blazor webassembly .DLL files failed to download
My work runs Sophos, which appears to allow DLLs to be served if you're serving them from a site using SSL - perhaps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found