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
ReferenceError: document is not defined #1113
Comments
Could u prepare a repository with the issue reproduced? |
I will if the following isn't sufficient. I realize the module is named .browser, so I'm either doing something wrong (with SSR perhaps) or there's an error with the following module. The issue seems to be with the function Uncompiled source
Distributed source
I'm receiving an error that and leaves the following stack trace:
|
You have mentioned SSR - are those |
The project this is used in uses SSR. An example project layout can be found here. In the |
Could u specify |
That did it. Thanks! |
What about
in rails webpacker, but then I was getting |
i don't think changing a target is good option. |
i'm trying to get emotion working with this SSR solution https://github.com/Limenius/ReactBundle, and as soon as I import emotion (without even using it) i get this |
I ran into the same problem when trying to use v10 with react-on-rails. v9 worked fine. Switching the webpack target unfortunately isn't an option for us. I haven't had a chance to dig into the source too much, but somewhere the test of whether we are in a browser or not changed between v9 and v10. |
Did you ever manage to solve this? |
Anyone find a solution to this? Changing our Webpack target isnt an option for us right now because of our BrowserList rules |
Relevant code:
package.json
webpack.config.js
src/components/body/elements.js
src/components/body/index.js
src/index.js
What you did:
I am attempting to rebuild a package that I maintain. However, the default component will function after being compiled by webpack. It will render correctly after a jest test though. Any attempt to use this package in another project results in a
ReferenceError
at runtime. I have pieced the <SimpleModal> component back together, to try and find the culprit, and it's the styled <Wrapper> element.What happened:
Rendering <Wrapper> as an element inside <Body> component raises a
ReferenceError: document is not defined
.The text was updated successfully, but these errors were encountered: