document is not defined with react-on-rails
See original GitHub issueCurrent 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.0emotion
version: 10.0.10
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top 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 >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
I am facing the same issue with ReactJS.net
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.