-
Notifications
You must be signed in to change notification settings - Fork 51
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
Vite: "Uncaught TypeError: Cannot read properties of undefined (reading 'Rive')" #342
Comments
Thanks very much, @Aratmany! Updated my repo. Works great! 🥳 Info: I followed this guide here (https://help.rive.app/runtimes/overview/web-js#id-1.-install-the-dependency), maybe an info box for Vite users would be helpful when getting started with Rive. Cheers! |
Thanks for the repro! Was trying to dig into Vite docs on why this might be an issue. First guess is that it has to do with Vite serving as ESM, and having issues with default imports on UMD builds. But we'll work on adding a blurb in the web docs to make this clearer for Vite config. |
👍 you're welcome! I'm not a pro in the field of ESM vs UMD unfortunately. Would be cool to find out what's going on. Maybe Dep Optimization Options and Dependency Pre-Bundling is also relevant. Also tried it with this Vite setting
But
also still gave Btw: I just added Layout as well and needed to use
instead of the functions described for Web in https://help.rive.app/runtimes/layout like So it affects all functions described in the docs. |
Hey @mandrasch - had to take a step back and refresh on what the main exports are here, but this is a docs issue mainly. The When importing the high-level
or alternatively, if you want a "default import" of a sort, you could do:
We updated docs now to reflect this clarification |
Hi @zplata, ah, makes sense. Thanks very much for explanation! 👍 👍 |
Description
Hi! I'm just getting started with Rive.
I wanted to create a simple demo with Vite (vanilla-ts) and I ran into the following error locally:
Line 30, main.ts:
I found another post on Discord, same error: Discord Post
Provide a Repro
The production build works fine though: https://rive-vite-demo.vercel.app/
Source
.riv
/.rev
fileExpected behavior
Screenshots
Browser & Versions (please complete the following information)
Additional context
Thanks in advance for any hints! 👋 Cheers! 🙂
The text was updated successfully, but these errors were encountered: