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.

document is not defined with react-on-rails

See original GitHub issue

Current behavior:

The documentation says that server side rendering works with no configuration needed if you install @emotion/core in a React app. I am getting document is not defined during the SSR.

I am using @emotion/styled, not css or jsx, I’m not sure if that could be where my problem is?

import * as React from 'react';
import styled from '@emotion/styled';

const Container = styled.div(
  {
    marginTop: 6,
    position: 'relative'
  },
  props => props.css
);

The error looks to be coming from a createCache method.

To reproduce:

I can create an example app if needed but I don’t have one handy.

Expected behavior:

The page should render.

Environment information:

  • react version: 16.8.0
  • emotion version: 10.0.10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
xtroncodecommented, Jun 20, 2019

I am facing the same issue with ReactJS.net

0reactions
Andaristcommented, Oct 27, 2019

Closing this because we have not received a repro case since September. It’s also definitely a problem with used tooling or its configuration - not something we can fix in Emotion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Document is not defined" Webpack + React on Rails + Server ...
Im use react_on_rails gem and im try render the component by the server. When i use components directly from the app it works...
Read more >
Modal is not working. Throws document is not defined error
I found a solution, I set a contst in my modal component on the window variable ...
Read more >
Referenceerror Document Is Not Defined React
Error is ReferenceError window while not defined Rails reactonrails hlcfan April. ReferenceError document is not defined Issue 319 reactjs.
Read more >
react-on-rails - npm
Note, if you got an error in your console regarding "ReferenceError: window is not defined", then you need to edit config/webpacker.yml and ...
Read more >
Getting Started - Shakacode
Add React on Rails to an existing Rails app per the instructions. ... If your application is not yet set up to use...
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