Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rive.wasm file size: >3x increase on 2.x.x versions #332

Closed
tomek-f opened this issue Aug 4, 2023 · 7 comments
Closed

rive.wasm file size: >3x increase on 2.x.x versions #332

tomek-f opened this issue Aug 4, 2023 · 7 comments

Comments

@tomek-f
Copy link

tomek-f commented Aug 4, 2023

1.2.4 - 204 kB (~90kB gzipped)
https://www.npmjs.com/package/@rive-app/canvas/v/1.2.4?activeTab=code

2.1.1 - 653 kB (268kB gzipped)
https://www.npmjs.com/package/@rive-app/canvas/v/2.1.1?activeTab=code

There's no info in the changelog https://github.com/rive-app/rive-wasm/blob/master/CHANGELOG.md

Tiny file size
Rive files are a fraction of the size of videos, GIFs, image sequences, or JSON-based formats. Whether you bundle your animations or deliver them remotely, our optimized format helps keep your app small.

Yup. Rive files are tiny, but the runtime is huge ;)

Is it a bug (eg. bad/unused imports)?

Is there smething that can be done to reduce the runtime size?

@zplata
Copy link
Contributor

zplata commented Aug 4, 2023

Hi @tomek-f ! Something went up in the release process for automating the CHANGELOG so thanks for pointing this out, we'll get this fixed up.

Regarding the runtime size, you're right, the WASM runtime got a major version bump from v1 to v2 due to a size increase for having a quite complex text engine compiled into the .wasm that powers the runtime. We're actively looking to optimize this such as determining which WASM to load when you instantiate Rive (i.e. detecting if you need a version with the text engine), loading the text engine on demand if needed, or even a more pared-down version to cut down on the size. We can keep this issue up until we have a solution released for this in the meantime.

If you don't have a need for Rive Text, you should use v1.2.4 and you'll have a much smaller dependency size from @rive-app/canvas

@tomek-f
Copy link
Author

tomek-f commented Aug 4, 2023

Thanks, @zplata

@dross15
Copy link

dross15 commented Oct 2, 2023

Have there been any updates in regard to this issue? We tried using v1.2.4 but with the latest version of rive-app/react-canvas (4.3.3) our animations were breaking, and we had to bump to v2.4.3. When working within Next.js (next.config.js) it causes our maxAssetSize to nearly 4x in size.

@zplata
Copy link
Contributor

zplata commented Oct 16, 2023

Hi - we should have a version coming out pretty soon here barring any complications in our testing! It will look something along the lines of consuming either a @rive-app/canvas-lite / @rive-app/canvas-advanved-lite and probably a React one as well. It should be about a third of the size it is today.

@zplata
Copy link
Contributor

zplata commented Oct 19, 2023

Hey all! We just released the packages mentioned above, @rive-app/canvas-lite and @rive-app/canvas-advanced-lite as v0.1.1. After we do some testing and validation, this should shortly align with the other web runtime versions. But feel free to use v0.1.1 now!

Note that this package will not have the text engine dependencies needed to render Rive Text, so if you have any .riv assets that have that, it will not render (but it will also not break your app if it does have it, or if you use the text APIs). Let us know if you run into issues with this.

Once this is validated, we'll likely make a @rive-app/react-canvas-lite or something of the sort.

@zplata
Copy link
Contributor

zplata commented Dec 4, 2023

@rive-app/react-canvas-lite is available and updated alongside the regular js/wasm runtimes! You should hopefully see a noticeable package size drop if you integrate either the @rive-app/canvas-lite or @rive-app/react-canvas-lite packages. Closing for now but feel free to open a new issue if you run into issues with it.

@zplata zplata closed this as completed Dec 4, 2023
@tomek-f
Copy link
Author

tomek-f commented Dec 5, 2023

Thank you, @zplata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants