material-components / material-components-web-react

Material Components for React (MDC React)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-button 0.14.0 broken in SSR due to window usage

renanbatel opened this issue · comments

Just got the new version (0.14.0) of react-button and I see that window is being used on the .js dist file. So I can't use it on my server rendered react app (next.js), 0.13.0 works fine.

I have the same issue using react-card - also downgrading to 0.13.0 works fine for me as well.

Thanks for opening the issue. I'll look into fixing this.

Looks like this is related to the webpack update.

EDIT: Looks like in v0.13.0 typeof self !== 'undefined' ? self : this has been replaced with window. I believe this is defined by the output.globalObject property in the configuration, which has a default to window. Remediation is to set

output.globalObject:  `typeof self !== 'undefined' ? self : this`

please try v0.14.1