GSAP not working with Hydrogen2 & Oxygen #494
-
Hello everyone, Code:
Error message: /Users/joevingracien/Documents/GitHub/Hydrogen/Deadground/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53 Error: Some functionality, such as asynchronous I/O (fetch, Cache API, KV), timeouts (setTimeout, setInterval), and generating random values (crypto.getRandomValues, crypto.subtle.generateKey), can only be performed while handling a request. Does anyone have any idea what's going on here or may have a suggestion / solution please ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
It looks like this is an issue in GSAP itself. When you use the Hydrogen CLI, it runs your app in a worker environment (Oxygen) instead of Node.js. Workers don't allow calling Edit: See the comments below for a workaround. |
Beta Was this translation helpful? Give feedback.
It looks like this is an issue in GSAP itself.
When you use the Hydrogen CLI, it runs your app in a worker environment (Oxygen) instead of Node.js. Workers don't allow calling
setTimeout
outside of request cycles (i.e. thefetch
export). However, GSAP callssetTimeout
at import time and it breaks the worker.Edit: See the comments below for a workaround.