react-animated-cursor icon indicating copy to clipboard operation
react-animated-cursor copied to clipboard

ReferenceError: document is not defined

Open yoneth opened this issue 2 years ago • 5 comments

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.

yoneth avatar Oct 12 '23 05:10 yoneth

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

  • Has use client directive.
  • Wraps all document uses in a check

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!

stephenscaff avatar Oct 15 '23 18:10 stephenscaff

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!

yannbellot avatar Oct 19 '23 16:10 yannbellot

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.

stephenscaff avatar Oct 19 '23 18:10 stephenscaff

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

yannbellot avatar Oct 19 '23 18:10 yannbellot

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 !

yannbellot avatar Nov 03 '23 17:11 yannbellot