Jump to content
Search Community

Gsap not working with Sveltekit typescript project

leo_svelte test
Moderator Tag

Recommended Posts

Hi,

 

I've setup my project with sveltekit (used npm create svelte@latest command). I installed gsap with npm and tried a basic animation. 

 

It's throwing TypeError: Cannot read properties of undefined (reading 'querySelectorAll') error. How can i resolve this? 

 

Link to comment
Share on other sites

Welcome to the forums, @leo_svelte

 

It sounds to me like you're trying to either use GSAP or register plugins BEFORE the document exists (SSR). Make sure you do those AFTER the document exists, like in a lifecycle callback. Here are some Sveltkit demos you can fork to try to recreate the issue: 

https://stackblitz.com/@GreenSockLearning/collections/gsap-sveltekit-starters

 

Once we see a minimal demo that illustrates the problem, I'm sure we'll have some advice to offer. 

 

Happy tweening!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...