Skip to content

ReferenceError: document is not defined at createTag... #101

@Beruguru

Description

@Beruguru

Hello everyone,

I had some issues with ReferenceError (with SSR).
And yes I know, it could be solved by dynamic import, lazy or maybe some other ways.

But the situation is like below:

  • There is a main(index) page with Lottie (lottie-react)
  • I've even use useEffect with isMount state to render the Lottie after the mount

case1.

  • No errors and works fine in Node 18 (v.18.18.0)

case2.

  • ReferenceError: document is not defined at createTag... occurs in higher version of Node (20, 21)

So, we (I and my co-worker) decided to fix Node version to 18 and it works fine.

But we are just curious about it.
Try to figure it out but all we can find is that the node version effects build in somehow.

If anyone knows what has been changed between 18 and higher, it would be nice to know of it.

Thank you so much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions