-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
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:
Uncaught TypeError: Cannot read properties of undefined (reading 'Rive')
at main.ts:30:22
Line 30, main.ts:
const canvas = document.getElementById("canvas") as HTMLCanvasElement|null;
if(canvas !== null){
const r = new rive.Rive({
I found another post on Discord, same error: Discord Post
I suspect this is because I'm trying to play a Rive file before the WASM file is loaded. But how do I check if that file is loaded?
Provide a Repro
- Stackblitz reproduction: https://stackblitz.com/edit/vitejs-vite-kmmmbl?file=index.html
- Repo GitHub: https://github.com/mandrasch/rive-vite-demo
The production build works fine though: https://rive-vite-demo.vercel.app/
Source .riv
/.rev
file
- See https://github.com/mandrasch/rive-vite-demo, example .riv file used
Expected behavior
- No error, Rive should load locally on Vite for local development
Screenshots
Browser & Versions (please complete the following information)
- Browser: Chrome Stable 120
- OS: macOS 13.5.2
- NPM Version: 9.8.0
Additional context
Thanks in advance for any hints! 👋 Cheers! 🙂
Metadata
Metadata
Assignees
Labels
No labels