question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: Element is not defined on SSR

See original GitHub issue

Hello, I’m getting a ReferenceError: Element is not defined when I try to SSR the Drawer component, running on version 0.7.1.

The issue is probably some optimization on the webpack build process where it removes “dead-code”, because the error occurs on the tabbable npm package, imported from focus-trap, specifically on this line. But, as you can see, it has a check specifically to avoid this issue when running on node environments. I have checked the minified code and have confirmed that the check for the typeof Element is optimized away.

Unfortunately I don’t have a reproducible codesandbox snippet as it doesn’t execute the code with SSR 😔

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:20 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
4cm4k1commented, Mar 1, 2019

Wow, awesome! Thanks, @lucasecdb! Also, thanks @moog16; I’m sorry I didn’t have time to continue working on my PR related to this. I started a new software engineering job, so that has been taking a lot of my time lately, though I think as I settle in there, I will be able to spend more of my time on GitHub again. 💜

1reaction
moog16commented, Jan 7, 2019

0.43.0 released today!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Universal SSR Issue - Element is not defined
I need to enable SSR on this project, but when the server is ready to access then crashes, with the error: ReferenceError: Element...
Read more >
React UIKit v3 error - ReferenceError: Element is not defined
Hello, I'm upgrading React UIKit from v2 to v3 and got an error message ReferenceError: Element is not defined.
Read more >
How to solve Next.js window is not defined
Solve a the common ReferenceError: next.js window is not defined error that you may see when doing SSR & pre-rendering.
Read more >
How To Fix ReferenceError document is not defined ... - Isotropic
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >
[Solved]-Next Js with react-xarrows gives error "ReferenceError
... react-xarrows gives error "ReferenceError: Element is not defined"-Reactjs. ... const Xarrow = dynamic(() => import('react-xarrows'), { ssr: false });.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found