-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Next.js Example Fails SSR #20926
Comments
Looks like the true source of this is likely the latest version of react-transition-group module. See reactjs/react-transition-group#618 I tried building the latest Gatsby SSR example too and eventually hit the same error (after I added 'react-jss' as a dependency). |
so how to fix it? |
No idea what the long term fix is (that's really up to react-transition-group's maintainers). To work around, you need to get rid of the 'Element' variable it is complaining about (it doesn't exist server-side). Workaround I'm using (from comments on reactjs/react-transition-group#618):
nodeRef: _propTypes.default.shape({
current: _propTypes.default.instanceOf(typeof Element === 'undefined' ? function(){} : Element)
}), This is very manual and a pretty delicate fix as updates to the node modules will wipe out the change. |
Duplicate of #20924 |
Current Behavior 😯
When following the instructions for downloading, installing, and running the dev version of the Next.js example in the material-ui/examples folder, the index page fails to compile and throws the error
ReferenceError: Element is not defined
from inside thereact-transition-group
module (a direct dependency of @material-ui/styles). This happens as soon as you runnpm run dev
and try to visitlocalhost:3000
Full error generated is:
Expected Behavior 🤔
The example page should render on the server successfully and be delivered to the client.
Steps to Reproduce 🕹
Easy way to reproduce:
It is broken when running in the codesandbox.io example in the same way I observe on my local machine.
Context 🔦
My goal is to get a working Material-UI example in Next.js. So far, I am just trying to get a working example of Next and MUI cooperating.
Your Environment 🌎
Latest everything, just use the code sandbox :-)
The text was updated successfully, but these errors were encountered: