-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document is not defined with react-on-rails #1407
Comments
How so you build your server? Webpack? |
Yes, using webpacker via rails |
I saw the other issue about cache breaking some static site generators....I don't think I have the same problem though. I have two bundles, one if which is for the server and uses renderToString. That is where I am having this error. |
I am facing the same issue with ReactJS.net |
You should use target: ‘node’ in your webpack config |
I don't think I can change that with webpacker :-/ |
Also, my code is running in the browser except that one bundle, don't I want it targeting the web? |
Well, I dont know how your bundles are structured - but in general client-side bundles are not the same as your SSR entry point, so you should have 2 separate builds. |
If you specify target as webworker the bundler should use default entries which have document access guarded. If this is not working properly you would have to prepare a repro case that would showcase the behavior and which would be easy to investigate. |
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. |
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 gettingdocument is not defined
during the SSR.I am using
@emotion/styled
, notcss
orjsx
, I'm not sure if that could be where my problem is?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.10The text was updated successfully, but these errors were encountered: