-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Error 'ReferenceError: "window" is not defined' in browserless environment #500
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
What is your use case for running CRA code in a server environment? |
I want to build an isomorphic application using ReactDomServer.renderToString. |
Create React App doesn’t currently support server rendering, sorry. See #91. |
Everything else SSR works fine, just one "window" problem is in polyfills.js for me. |
How do you configure Babel on the server? We don’t expose Babel configs so I’m not sure how that works for you. |
I don't use babel on server, I need only a compiled main.*.js result file. I am using java/nashorn js implementation like in https://github.com/pugnascotia/spring-react-boilerplate. |
How do you switch between server and client implementation? Do you just check if |
Yes, you are right. I am checking it. |
How do you find the build output? Do you just take the first |
After executing "react-scripts build" I have only one js file like main.*.js in build/static/js folder, so I take it. |
I see. This might become harder in the future if we start splitting it up into additional bundles. I’d say we don’t officially support that, so your best bet is to |
ok, thanks a lot. |
Yea, sorry if it’s frustrating. Can’t solve all problems in one tool 😄 . |
An issue occurs when polyfills.js is being used in a browserless environment, such as being run directly using Node or Nashorn.