ReferenceError: Element is not defined on SSR
See original GitHub issueHello, 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:
- Created 5 years ago
- Reactions:2
- Comments:20 (19 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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. 💜
0.43.0 released today!