stephenscaff / react-animated-cursor

An animated custom cursor React component.
ISC License
273 stars 28 forks source link

ReferenceError: document is not defined #60

Open yoneth opened 6 months ago

yoneth commented 6 months ago

Hello, I am currently designing a Framer template that utilizes the "Cursor Follower" Framer module, which imports react-animated-cursor.

The author of 'Cursor Follower' module has stated that the error is associated with the external NPM library react-animated-cursor. Below is the error log from Framer :

Pages that failed to optimize:

### /
document is not defined
ReferenceError: document is not defined
    at u (file:///tmp/framer-ssg-BBjPoi/NLBZRBq3Veei-r9JhD4DCmPfwRKJ6p6rHHkV1lLcBsM.SVONRRR2.mjs:1:8258)
    at br (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:10899)
    at at (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:11638)
    at B (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:13844)
    at at (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:11865)
    at B (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:13844)
    at at (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:11952)
    at B (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:13844)
    at at (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:11865)
    at B (file:///tmp/framer-ssg-BBjPoi/ssgdeps.OVFUYB72.mjs:11:13844)

Please advise.

stephenscaff commented 6 months ago

Hi. Thanks for the heads up.

Honestly, that notice doesn't help me much. I'd need the plugin author to let me know what version they're using, and any other useful info about the Framer environment (since it's unique).

But.... document is not defined provides a few clues.

I just published 2.11.1 which may have addressed this issue as it refactored for better Next.js and server/client component integration. This plugin

See if the plugin author can try updating this dep. Also, see if they can reach out with an issue directly.

More than happy to investigate with a bit more help.

Thanks!

yannbellot commented 6 months ago

Hi Stephen, Thanks for your help and thank you for react-animated-cursor. It's really great work! I am the author of the plugin. I have this error: "TypeError: Cannot read properties of null (reading 'style') (:0:0 at at https://ga.jspm.io/npm:react-animated-cursor (2.7.0/dist/index.umd.js:34:301)" Is this accurate enough for you? Best!

stephenscaff commented 6 months ago

Hey hey! Thanks for hopping over with some info. I have an idea of what maybe causing this.

I was setting the cursor style to none outside of a side effect.

Not 100 on this, but it might be the culprit. Will let you know when I push next version if you could then try updating and see how it goes?

Thanks.

yannbellot commented 6 months ago

Thank you for your quick reply. I will update with the next version. THANKS !

yannbellot commented 6 months ago

Hey, I see you've released 2.11.2. Does this update include the patch? I still see the same error code. Thanks for your reply. Best !