Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: document is not defined #60

Open
yoneth opened this issue Oct 12, 2023 · 5 comments
Open

ReferenceError: document is not defined #60

yoneth opened this issue Oct 12, 2023 · 5 comments

Comments

@yoneth
Copy link

yoneth commented Oct 12, 2023

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
Copy link
Owner

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!

@yannbellot
Copy link

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
Copy link
Owner

stephenscaff commented Oct 19, 2023

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
Copy link

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

@yannbellot
Copy link

yannbellot commented Nov 3, 2023

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants